[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/webdav/ - Fixup usage of urljoin in webdav.davcmds

Sidnei da Silva sidnei at enfoldsystems.com
Mon Jul 17 19:36:50 EDT 2006


Log message for revision 69167:
  
  - Fixup usage of urljoin in webdav.davcmds
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/webdav/common.py
  U   Zope/branches/Zope-2_8-branch/lib/python/webdav/davcmds.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/webdav/common.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/webdav/common.py	2006-07-17 23:35:46 UTC (rev 69166)
+++ Zope/branches/Zope-2_8-branch/lib/python/webdav/common.py	2006-07-17 23:36:49 UTC (rev 69167)
@@ -42,6 +42,11 @@
         return attr()
     return attr
 
+def urljoin(url, s):
+    url = url.rstrip('/')
+    s = s.lstrip('/')
+    return '/'.join((url, s))
+
 def urlfix(url, s):
     n=len(s)
     if url[-n:]==s: url=url[:-n]

Modified: Zope/branches/Zope-2_8-branch/lib/python/webdav/davcmds.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/webdav/davcmds.py	2006-07-17 23:35:46 UTC (rev 69166)
+++ Zope/branches/Zope-2_8-branch/lib/python/webdav/davcmds.py	2006-07-17 23:36:49 UTC (rev 69167)
@@ -17,7 +17,7 @@
 """
 
 import sys
-from common import absattr, aq_base, urlfix, urlbase
+from common import absattr, aq_base, urlfix, urlbase, urljoin
 from OFS.PropertySheets import DAVProperties
 from LockItem import LockItem
 from WriteLockInterface import WriteLockInterface
@@ -29,7 +29,6 @@
 from zExceptions import BadRequest, Forbidden
 from common import isDavCollection
 from common import PreconditionFailed
-from ZConfig.url import urljoin
 import transaction
 
 def safe_quote(url, mark=r'%'):
@@ -163,8 +162,8 @@
                     if dflag:
                         ob._p_deactivate()
                 elif hasattr(ob, '__dav_resource__'):
-                    uri=urljoin(url, absattr(ob.id))
-                    depth=depth=='infinity' and depth or 0
+                    uri = urljoin(url, absattr(ob.getId()))
+                    depth = depth=='infinity' and depth or 0
                     self.apply(ob, uri, depth, result, top=0)
                     if dflag:
                         ob._p_deactivate()
@@ -403,7 +402,7 @@
         if depth == 'infinity' and iscol:
             for ob in obj.objectValues():
                 if hasattr(obj, '__dav_resource__'):
-                    uri = urljoin(url, absattr(ob.id))
+                    uri = urljoin(url, absattr(ob.getId()))
                     self.apply(ob, creator, depth, token, result,
                                uri, top=0)
         if not top:
@@ -466,7 +465,7 @@
             for ob in obj.objectValues():
                 if hasattr(ob, '__dav_resource__') and \
                    WriteLockInterface.isImplementedBy(ob):
-                    uri = urljoin(url, absattr(ob.id))
+                    uri = urljoin(url, absattr(ob.getId()))
                     self.apply(ob, token, uri, result, top=0)
         if not top:
             return result
@@ -520,7 +519,7 @@
             for ob in obj.objectValues():
                 dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None)
                 if hasattr(ob, '__dav_resource__'):
-                    uri = urljoin(url, absattr(ob.id))
+                    uri = urljoin(url, absattr(ob.getId()))
                     self.apply(ob, token, user, uri, result, top=0)
                     if dflag:
                         ob._p_deactivate()



More information about the Zope-Checkins mailing list