changeset 72:b2ea14bf9f46

add a slash to the namespaced directory
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 02 Mar 2012 11:35:49 -0800
parents dcb98ad8463e
children ca92de52aa33
files simpypi/factory.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simpypi/factory.py	Fri Mar 02 11:29:57 2012 -0800
+++ b/simpypi/factory.py	Fri Mar 02 11:35:49 2012 -0800
@@ -11,6 +11,7 @@
 import tempfile
 
 from fileserver import DirectoryServer
+from webob import exc
 from wsgi import SimPyPI
 from wsgiref import simple_server
 
@@ -24,6 +25,8 @@
     def __call__(self, environ, start_response):
         path = environ['PATH_INFO']
         if path == self.namespace:
+            response = exc.HTTPMovedPermanently(add_slash=True)
+            return response(environ, start_response)
             environ['PATH_INFO'] = '/'
             return DirectoryServer.__call__(self, environ, start_response)
         elif path.startswith(self.namespace + '/'):