def entry(request): ret = chain.run([route], request=request) body = ret.get('render') content_type = ret.get('content_type') return Response(body, content_type=content_type)
def chain(self, args): from iromidori.evapi import route kw = { "request": self.request, "url": self.request.path[4:], # XXX! } kw.update(args) # XXX: insecure! ret = chain.run([route], **kw) json = ret.get('json') or "Nani-Nani" self.write(json)
def application(environ, start_response): """ Typical werkzeug app, nothing special. Here I`m handling incoming request and passing it to chain of functions (route, response). Execution context is almost empty, except our request. """ request = Request(environ, populate_request=False) ret = chain.run([route, response], request=request) return ret['response'](environ, start_response)
def evapi(**kw): return chain.run([route], **kw)
def evapi(**kw): return chain.run([parse, route], **kw)