Mercurial > hg > wsgintegrate
comparison wsgintegrate/web.py @ 0:ec815b7cb142
initial commit of wsgintegrate
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 07 Jun 2011 08:03:09 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ec815b7cb142 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 # XXX legacy WSGIblob code; to be ported [TODO] | |
4 | |
5 """ | |
6 web handlers for wsgiblob | |
7 """ | |
8 | |
9 import sys | |
10 from webob import exc | |
11 from webob import Request | |
12 from webob import Response | |
13 | |
14 class JSONhandler(object): | |
15 """handles JSON requests""" | |
16 | |
17 def __init__(self, factory): | |
18 self.factory = factory | |
19 | |
20 def __call__(self, environ, start_response): | |
21 request = Request(environ) | |
22 if request.method == 'GET': | |
23 response = Response(content_type='application/json', | |
24 body=self.factory.json_config()) | |
25 return response(environ, start_response) | |
26 elif request.method == 'POST': | |
27 raise NotImplementedError | |
28 else: | |
29 raise NotImplementedError | |
30 | |
31 def main(args=sys.argv[1:]): | |
32 from factory import StringFactory | |
33 raise NotImplementedError | |
34 f = StringFactory(config={'':dict(type='app')}) | |
35 | |
36 if __name__ == '__main__': | |
37 main() |