[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Forward-port fix from 2.7:

Sidnei da Silva sidnei at enfoldsystems.com
Tue Jun 21 11:33:35 EDT 2005


Log message for revision 30876:
  
  - Forward-port fix from 2.7:
  
        - WebDAV COPY and MOVE did not call '_notifyOfCopyTo' and
          '_postCopy' hooks like it was done in
          OFS.CopySupport. Additionally added
          'manage_changeOwnershipType' to make MOVE behave even closer
          to OFS.CopySupport.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/webdav/Resource.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-21 15:30:24 UTC (rev 30875)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-21 15:33:34 UTC (rev 30876)
@@ -38,6 +38,12 @@
 
       - Fixed CMFBTreeFolder for CMF 1.5+
 
+      - WebDAV COPY and MOVE did not call '_notifyOfCopyTo' and
+        '_postCopy' hooks like it was done in
+        OFS.CopySupport. Additionally added
+        'manage_changeOwnershipType' to make MOVE behave even closer
+        to OFS.CopySupport.
+
       - Collector #1548: Fix 'httplib' usage in ZPublisher.Client.
 
       - Collector #1808: manage_convertIndexes no longer tries to change the

Modified: Zope/branches/Zope-2_8-branch/lib/python/webdav/Resource.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/webdav/Resource.py	2005-06-21 15:30:24 UTC (rev 30875)
+++ Zope/branches/Zope-2_8-branch/lib/python/webdav/Resource.py	2005-06-21 15:33:34 UTC (rev 30876)
@@ -373,6 +373,7 @@
             else:
                 raise Locked, 'Destination is locked.'
 
+        self._notifyOfCopyTo(parent, op=0)
         ob = self._getCopy(parent)
         ob._setId(name)
 
@@ -385,6 +386,7 @@
             parent._delObject(name)
         parent._setObject(name, ob)
         ob = parent._getOb(name)
+        ob._postCopy(parent, op=0)
         ob.manage_afterClone(ob)
         # We remove any locks from the copied object because webdav clients
         # don't track the lock status and the lock token for copied resources
@@ -481,7 +483,12 @@
                 raise PreconditionFailed, 'Source is locked and no '\
                       'condition was passed in.'
 
-        ob=aq_base(self._getCopy(parent))
+        # try to make ownership explicit so that it gets carried
+        # along to the new location if needed.
+        self.manage_changeOwnershipType(explicit=1)
+
+        self._notifyOfCopyTo(parent, op=1)
+        ob = aq_base(self._getCopy(parent))
         self.aq_parent._delObject(absattr(self.id))
         ob._setId(name)
         if existing:
@@ -489,6 +496,12 @@
             self.dav__validate(object, 'DELETE', REQUEST)
             parent._delObject(name)
         parent._setObject(name, ob)
+        ob = parent._getOb(name)
+        ob._postCopy(parent, op=1)
+
+        # try to make ownership implicit if possible
+        ob.manage_changeOwnershipType(explicit=0)
+
         RESPONSE.setStatus(existing and 204 or 201)
         if not existing:
             RESPONSE.setHeader('Location', dest)



More information about the Zope-Checkins mailing list