# HG changeset patch # User Jeff Hammel # Date 1330477160 28800 # Node ID e72d9655d753de74a7677db9a248446b866aa63f # Parent 53328d3d9936b46ac87379e02e0798ee496c312d start stubbing a directory server diff -r 53328d3d9936 -r e72d9655d753 simpypi/factory.py --- a/simpypi/factory.py Tue Feb 28 16:39:52 2012 -0800 +++ b/simpypi/factory.py Tue Feb 28 16:59:20 2012 -0800 @@ -16,6 +16,13 @@ from wsgi import SimPyPI from wsgiref import simple_server +class DirectoryServer(StaticURLParser): + def __init__(self, directory): + StaticUrlParser.__init__(self, directory) + + def __call__(self, environ, start_response): + import pdb; pdb.set_trace() + class PassthroughFileserver(object): """serve files if they exist""" @@ -30,10 +37,11 @@ return self.fileserver(environ, start_response) return self.app(environ, start_response) -class NamespacedFileserver(PassthroughFileserver): +class NamespacedFileserver(DirectoryServer): def __init__(self, app, directory, namespace): - PassthroughFileserver.__init__(self, app, directory) + DirectoryServer.__init__(self, directory) + self.app = app self.namespace = namespace def __call__(self, environ, start_response): @@ -46,6 +54,7 @@ return self.fileserver(environ, start_response) return self.app(environ, start_response) + def factory(**app_conf): """create a webob view and wrap it in middleware""" directory = app_conf['directory']