comparison simpypi/factory.py @ 1:24b8d06eae53

stub out a simple view
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Feb 2012 15:57:01 -0800
parents 93e830409685
children b03602153de2
comparison
equal deleted inserted replaced
0:93e830409685 1:24b8d06eae53
17 path = environ['PATH_INFO'].strip('/') 17 path = environ['PATH_INFO'].strip('/')
18 if path and os.path.exists(os.path.join(self.directory, path)): 18 if path and os.path.exists(os.path.join(self.directory, path)):
19 return self.fileserver(environ, start_response) 19 return self.fileserver(environ, start_response)
20 return self.app(environ, start_response) 20 return self.app(environ, start_response)
21 21
22 def factory(global_conf, **app_conf): 22 def factory(**app_conf):
23 """create a webob view and wrap it in middleware""" 23 """create a webob view and wrap it in middleware"""
24 app = Dispatcher(**app_conf)
25 return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static')))
24 26
25 keystr = 'simpypi.' 27 if __name__ == '__main__':
26 args = dict([(key.split(keystr, 1)[-1], value) 28 import tempfile
27 for key, value in app_conf.items() 29 from wsgiref import simple_server
28 if key.startswith(keystr) ]) 30 app = factory
29 app = Dispatcher(**args)
30 return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static')))
31