[Zope] why does absolute_url now call urllib.quote?

Anthony Baxter anthony@interlink.com.au
Tue, 07 Sep 1999 16:44:19 +1000


Sometime on the way to Zope2, OFS.SimpleItem.Item.absolute_url was changed 
to call urllib.quote on the string it produces. This will break things
that expected the previous behaviour... 

Just a warning for anyone else who might be bitten by this (it breaks
my dataminer... :(

(see line marked 'This line.' in the following diff.)

-    def absolute_url(self):
+    def absolute_url(self, relative=0):
         """Return an absolute url to the object. Note that the url
         will reflect the acquisition path of the object if the object
         has been acquired."""
         obj=self
         url=[]
         while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'):
-            id=callable(obj.id) and obj.id() or obj.id
-            url.append(id)
+            id=callable(obj.id) and obj.id() or str(obj.id)
+            url.append(quote(id))  # << This line.
             obj=obj.aq_parent
-        url.append(self.aq_acquire('REQUEST').script)
+        if not relative: url.append(self.aq_acquire('REQUEST').script)
         url.reverse()
         return join(url, '/')


--
Anthony Baxter     <anthony@interlink.com.au>
It's never too late to have a happy childhood.