[Zope-Checkins] CVS: Zope2 - davcmds.py:1.8.98.1

Brian Lloyd brian@digiciool.com
Thu, 8 Mar 2001 11:19:08 -0500 (EST)


Update of /cvs-repository/Zope2/lib/python/webdav
In directory korak:/home/brian/temp/zope-23-branch/lib/python/webdav

Modified Files:
      Tag: zope-2_3-branch
	davcmds.py 
Log Message:
fixed double-quoting problem in generated DAV:href properties



--- Updated File davcmds.py in package Zope2 --
--- davcmds.py	2000/05/26 15:50:36	1.8
+++ davcmds.py	2001/03/08 16:19:08	1.8.98.1
@@ -94,6 +94,10 @@
 from cStringIO import StringIO
 from urllib import quote
 
+def safe_quote(url, mark=r'%', find=string.find):
+    if find(url, mark) > -1:
+        return url
+    return quote(url)
 
 class DAVProps(DAVProperties):
     """Emulate required DAV properties for objects which do
@@ -156,7 +160,7 @@
                          '<d:multistatus xmlns:d="DAV:">\n')
         iscol=hasattr(obj, '__dav_collection__')
         if iscol and url[-1] != '/': url=url+'/'
-        result.write('<d:response>\n<d:href>%s</d:href>\n' % quote(url))
+        result.write('<d:response>\n<d:href>%s</d:href>\n' % safe_quote(url))
         if hasattr(aq_base(obj), 'propertysheets'):
             propsets=obj.propertysheets.values()
             obsheets=obj.propertysheets