changeset 23:e72d9655d753

start stubbing a directory server
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 28 Feb 2012 16:59:20 -0800
parents 53328d3d9936
children 13ed82d10144
files simpypi/factory.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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']