SVN: r26199 - trunk/quixote

David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Fri, 18 Feb 2005 17:54:57 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: dbinger
Date: 2005-02-18 17:54:57 -0500 (Fri, 18 Feb 2005)
New Revision: 26199

Modified:
    trunk/quixote/publish.py
Log:
Don't remove double slashes from the path.  A URL is allowed to have 
empty
components.

Just use assert for checking that the first character of PATH_INFO is 
'/'.
If this happens it really is an internal server error.

Changed:
publish.py


Modified: trunk/quixote/publish.py
===================================================================
--- trunk/quixote/publish.py	2005-02-18 22:12:36 UTC (rev 26198)
+++ trunk/quixote/publish.py	2005-02-18 22:54:57 UTC (rev 26199)
@@ -5,7 +5,7 @@
  """

  import sys, traceback, cStringIO
-import time, re
+import time
  import urlparse
  import cgitb

@@ -237,8 +237,6 @@
          return error_file.getvalue()


-    _SLASH_PAT = re.compile("//*")
-
      def try_publish(self, request):
          """(request : HTTPRequest) -> object

@@ -247,11 +245,8 @@
          """
          self.start_request()
          path = request.get_environ('PATH_INFO', '')
-        if path[:1] != '/':
-            raise PublishError("PATH_INFO should start with '/'")
+        assert path[:1] == '/'
          # split path into components
-        if '//' in path:
-            path = self._SLASH_PAT.sub("/", path)
          path = path[1:].split('/')
          output = self.root_directory._q_traverse(path)
          # The callable ran OK, commit any changes to the session