[CalendarServer-changes] [509]
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.
copymove.patch
source_changes at macosforge.org
source_changes at macosforge.org
Fri Nov 17 08:48:44 PST 2006
Revision: 509
http://trac.macosforge.org/projects/calendarserver/changeset/509
Author: cdaboo at apple.com
Date: 2006-11-17 08:48:44 -0800 (Fri, 17 Nov 2006)
Log Message:
-----------
Fix moving so that a move to a new resource in the same directory uses the move operation rather than
storeResource. That ensures that xattrs (properties) are preserved. Ultimately we need to fix xattr
so that a copy of a resource preserves xattrs.
Modified Paths:
--------------
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.copymove.patch
Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.copymove.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.copymove.patch 2006-11-17 16:47:13 UTC (rev 508)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.copymove.patch 2006-11-17 16:48:44 UTC (rev 509)
@@ -2,7 +2,12 @@
===================================================================
--- twisted/web2/dav/method/copymove.py (revision 18545)
+++ twisted/web2/dav/method/copymove.py (working copy)
-@@ -38,7 +38,7 @@
+@@ -34,11 +34,12 @@
+ from twisted.python import log
+ from twisted.internet.defer import waitForDeferred, deferredGenerator
+ from twisted.web2 import responsecode
++from twisted.web2.dav.fileop import move
+ from twisted.web2.http import HTTPError, StatusResponse
from twisted.web2.filter.location import addLocation
from twisted.web2.dav import davxml
from twisted.web2.dav.idav import IDAVResource
@@ -11,7 +16,7 @@
from twisted.web2.dav.util import parentForURL
# FIXME: This is circular
-@@ -81,7 +81,15 @@
+@@ -81,7 +82,15 @@
# May need to add a location header
addLocation(request, destination_uri)
@@ -28,19 +33,44 @@
yield x
yield x.getResult()
-@@ -144,7 +152,14 @@
+@@ -100,7 +109,8 @@
+ #
+ # Check authentication and access controls
+ #
+- parent = waitForDeferred(request.locateResource(parentForURL(request.uri)))
++ parentURL = parentForURL(request.uri)
++ parent = waitForDeferred(request.locateResource(parentURL))
+ yield parent
+ parent = parent.getResult()
+
+@@ -117,7 +127,8 @@
+ yield x
+ x.getResult()
+ else:
+- destparent = waitForDeferred(request.locateResource(parentForURL(destination_uri)))
++ destparentURL = parentForURL(destination_uri)
++ destparent = waitForDeferred(request.locateResource(destparentURL))
+ yield destparent
+ destparent = destparent.getResult()
+
+@@ -144,7 +155,19 @@
log.err(msg)
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
- x = waitForDeferred(move(self.fp, request.uri, destination.fp, destination_uri, depth))
-+ #x = waitForDeferred(move(self.fp, request.uri, destination.fp, destination_uri, depth))
-+ x = waitForDeferred(put_common.storeResource(request,
-+ source=self,
-+ source_uri=request.uri,
-+ destination=destination,
-+ destination_uri=destination_uri,
-+ deletesource=True,
-+ depth=depth))
++ # Lets optimise a move within the same directory to a new resource as a simple move
++ # rather than using the full transaction based storeResource api. This allows simple
++ # "rename" operations to work quickly.
++ if (not destination.exists()) and destparent == parent:
++ x = waitForDeferred(move(self.fp, request.uri, destination.fp, destination_uri, depth))
++ else:
++ x = waitForDeferred(put_common.storeResource(request,
++ source=self,
++ source_uri=request.uri,
++ destination=destination,
++ destination_uri=destination_uri,
++ deletesource=True,
++ depth=depth))
yield x
yield x.getResult()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061117/2f334a2e/attachment.html
More information about the calendarserver-changes
mailing list