[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.1.2.13

Shane Hathaway shane@digicool.com
Tue, 27 Nov 2001 15:50:37 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv22985/lib/python/Zope/Publisher

Modified Files:
      Tag: Zope-3x-branch
	BaseRequest.py 
Log Message:
Fixed URL quoting of semicolons and other characters that don't need to
be quoted in the path component of a URL.


=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.12 => 1.1.2.13 ===
 
 
+def pc_quote(s):
+    """
+    URL-quotes only the characters not allowed in the path
+    component of a URL.  See RFC 2396 Section 3.3.
+    """
+    return quote(s, "/:@&=+$,;")
+
+
 _marker = []
 
 class BaseRequest:
@@ -253,7 +261,7 @@
         self.traversed = traversed = []
         traversed.append(object)
         steps = self.steps
-        self.quoted_steps = quoted_steps = map(quote, steps)
+        self.quoted_steps = quoted_steps = map(pc_quote, steps)
         to_traverse.reverse()
         self.to_traverse = to_traverse
 
@@ -270,7 +278,7 @@
                 # Traverse to the next step.
                 entry_name = to_traverse.pop()
                 if entry_name:
-                    qstep = quote(entry_name)
+                    qstep = pc_quote(entry_name)
                     quoted_steps.append(qstep)
                     if not added_default:
                         # Build up the URL to the object, but not