Basic wsgi app working inside twisted
[fwx] / phial.py
1 import collections
2
3 Request = collections.namedtuple(
4     'Request',
5     (
6         'environ',
7     )
8 )
9
10 Response = collections.namedtuple(
11     'Response',
12     (
13         'status',
14         'headers',
15         'content',
16     ),
17 )
18
19 def App(handler):
20     def app(environ, start_fn):
21         response = handler(Request(environ))
22
23         start_fn(response.status, response.headers)
24         return response.content
25     return app