Mercurial > hg > wsgintegrate
view wsgintegrate/web.py @ 2:70fa0bda7726
stub factory class built on pyloader class
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 13 Jun 2011 07:35:03 -0700 |
parents | ec815b7cb142 |
children |
line wrap: on
line source
#!/usr/bin/env python # XXX legacy WSGIblob code; to be ported [TODO] """ web handlers for wsgiblob """ import sys from webob import exc from webob import Request from webob import Response class JSONhandler(object): """handles JSON requests""" def __init__(self, factory): self.factory = factory def __call__(self, environ, start_response): request = Request(environ) if request.method == 'GET': response = Response(content_type='application/json', body=self.factory.json_config()) return response(environ, start_response) elif request.method == 'POST': raise NotImplementedError else: raise NotImplementedError def main(args=sys.argv[1:]): from factory import StringFactory raise NotImplementedError f = StringFactory(config={'':dict(type='app')}) if __name__ == '__main__': main()