Mercurial > hg > FileServer
diff fileserver/web.py @ 13:e3993fa05b89
cleanup
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 29 Feb 2012 15:42:14 -0800 |
parents | 8127dde8da22 |
children | 27bd18f0a359 |
line wrap: on
line diff
--- a/fileserver/web.py Wed Feb 29 15:41:01 2012 -0800 +++ b/fileserver/web.py Wed Feb 29 15:42:14 2012 -0800 @@ -49,11 +49,6 @@ def normpath(path): return os.path.normcase(os.path.abspath(path)) - def add_slash(self, request): - import pdb; pdb.set_trace() - location = '' - response = exc.HTTPMovedPermanantly() - def index(self, directory): """ generate a directory listing for a given directory @@ -72,12 +67,11 @@ # TODO method_not_allowed: Allow: GET, HEAD path_info = request.path_info if not path_info: - pass # self.add slash + response = exc.HTTPMovedPermanently(add_slash=True) + return response(environ, start_response) full = self.normpath(os.path.join(self.directory, path_info.strip('/'))) if not full.startswith(self.directory): - print 'OUT OF BOUNDS!' - import pdb; pdb.set_trace() # Out of bounds return exc.HTTPNotFound()(environ, start_response) if not os.path.exists(full): @@ -88,10 +82,7 @@ if not path_info.endswith('/'): response = exc.HTTPMovedPermanently(add_slash=True) return response(environ, start_response) - return self.add_slash(environ, start_response) index = self.index(full) - response_headers = [('Content-Type', 'text/html'), - ('Content-Length', str(len(index)))] response = Response(index, content_type='text/html') return response(environ, start_response)