[CalendarServer-changes] [3240] CalendarServer/trunk/twistedcaldav/method/put_common.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 27 13:09:03 PDT 2008


Revision: 3240
          http://trac.macosforge.org/projects/calendarserver/changeset/3240
Author:   cdaboo at apple.com
Date:     2008-10-27 13:09:03 -0700 (Mon, 27 Oct 2008)
Log Message:
-----------
Rollback files need to have "." prefix so that they are not part of PROPFIND listings etc.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/method/put_common.py

Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py	2008-10-27 20:05:43 UTC (rev 3239)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py	2008-10-27 20:09:03 UTC (rev 3240)
@@ -509,11 +509,15 @@
         so rename the original file in case we need to rollback.
         """
 
+        def _createRollbackPath(path):
+            parent, child = os.path.split(path)
+            child = "." + child + ".rollback"
+            return os.path.join(parent, child)
+
         self.rollback = StoreCalendarObjectResource.RollbackState(self)
         self.overwrite = self.destination.exists()
         if self.overwrite:
-            self.rollback.destination_copy = FilePath(self.destination.fp.path)
-            self.rollback.destination_copy.path += ".rollback"
+            self.rollback.destination_copy = FilePath(_createRollbackPath(self.destination.fp.path))
             copyToWithXAttrs(self.destination.fp, self.rollback.destination_copy)
             log.debug("Rollback: backing up destination %s to %s" % (self.destination.fp.path, self.rollback.destination_copy.path))
         else:
@@ -521,8 +525,7 @@
             log.debug("Rollback: will create new destination %s" % (self.destination.fp.path,))
 
         if self.deletesource:
-            self.rollback.source_copy = FilePath(self.source.fp.path)
-            self.rollback.source_copy.path += ".rollback"
+            self.rollback.source_copy = FilePath(_createRollbackPath(self.source.fp.path))
             copyToWithXAttrs(self.source.fp, self.rollback.source_copy)
             log.debug("Rollback: backing up source %s to %s" % (self.source.fp.path, self.rollback.source_copy.path))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081027/13ec00f0/attachment.html>


More information about the calendarserver-changes mailing list