[CalendarServer-changes] [1337] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 6 14:18:22 PST 2007
Revision: 1337
http://trac.macosforge.org/projects/calendarserver/changeset/1337
Author: cdaboo at apple.com
Date: 2007-03-06 14:18:21 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
Calendar collection entity tag support.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/customxml.py
CalendarServer/trunk/twistedcaldav/method/delete.py
CalendarServer/trunk/twistedcaldav/method/put_common.py
CalendarServer/trunk/twistedcaldav/static.py
Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py 2007-03-06 21:25:39 UTC (rev 1336)
+++ CalendarServer/trunk/twistedcaldav/customxml.py 2007-03-06 22:18:21 UTC (rev 1337)
@@ -208,6 +208,14 @@
namespace = calendarserver_namespace
name = "unsubscribe"
+class GETCTag (davxml.WebDAVTextElement):
+ """
+ Contains the calendar collection entity tag.
+ """
+ namespace = calendarserver_namespace
+ name = "getctag"
+ protected = True
+
##
# Extensions to davxml.ResourceType
##
Modified: CalendarServer/trunk/twistedcaldav/method/delete.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/delete.py 2007-03-06 21:25:39 UTC (rev 1336)
+++ CalendarServer/trunk/twistedcaldav/method/delete.py 2007-03-06 22:18:21 UTC (rev 1337)
@@ -22,9 +22,12 @@
__all__ = ["http_DELETE"]
+import datetime
+
from twisted.web2 import responsecode
from twisted.web2.dav.util import parentForURL
+from twistedcaldav import customxml
from twistedcaldav.resource import isPseudoCalendarCollectionResource
def http_DELETE(self, request):
@@ -38,6 +41,9 @@
if isPseudoCalendarCollectionResource(parent):
index = parent.index()
index.deleteResource(self.fp.basename())
+
+ # Change CTag on the parent calendar collection
+ parent.writeDeadProperty(customxml.GETCTag(str(datetime.datetime.now())))
return response
Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py 2007-03-06 21:25:39 UTC (rev 1336)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py 2007-03-06 22:18:21 UTC (rev 1337)
@@ -22,6 +22,8 @@
__all__ = ["storeCalendarObjectResource"]
+import datetime
+
from twisted.internet.defer import deferredGenerator
from twisted.internet.defer import maybeDeferred
from twisted.internet.defer import waitForDeferred
@@ -43,6 +45,7 @@
from twistedcaldav.caldavxml import NoUIDConflict
from twistedcaldav.caldavxml import NumberOfRecurrencesWithinLimits
from twistedcaldav.caldavxml import caldav_namespace
+from twistedcaldav import customxml
from twistedcaldav.ical import Component
from twistedcaldav.instance import TooManyInstancesError
from twistedcaldav.resource import CalDAVResource
@@ -411,7 +414,7 @@
logging.debug("Rollback: backing up source %s to %s" % (source.fp.path, rollback.source_copy.path), system="Store Resource")
"""
- Handle actual store oeprations here.
+ Handle actual store operations here.
The order in which this is done is import:
@@ -525,6 +528,9 @@
yield d
d.getResult()
+ if sourcecal:
+ # Change CTag on the parent calendar collection
+ sourceparent.writeDeadProperty(customxml.GETCTag(str(datetime.datetime.now())))
if destinationcal:
result = doDestinationIndex(calendar)
@@ -547,6 +553,11 @@
yield d
d.getResult()
+
+ if destinationcal:
+ # Change CTag on the parent calendar collection
+ destinationparent.writeDeadProperty(customxml.GETCTag(str(datetime.datetime.now())))
+
# Can now commit changes and forget the rollback details
rollback.Commit()
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2007-03-06 21:25:39 UTC (rev 1336)
+++ CalendarServer/trunk/twistedcaldav/static.py 2007-03-06 22:18:21 UTC (rev 1337)
@@ -34,6 +34,7 @@
"NotificationFile",
]
+import datetime
import os
import errno
from urlparse import urlsplit
@@ -124,8 +125,18 @@
#
# Create the collection once we know it is safe to do so
#
- return self.createSpecialCollection(davxml.ResourceType.calendar)
+ def onCalendarCollection(status):
+ if status != responsecode.CREATED:
+ raise HTTPError(status)
+ # Initialize CTag on the calendar collection
+ self.writeDeadProperty(customxml.GETCTag(str(datetime.datetime.now())))
+ return status
+
+ d = self.createSpecialCollection(davxml.ResourceType.calendar)
+ d.addCallback(onCalendarCollection)
+ return d
+
def createSpecialCollection(self, resourceType=None):
#
# Create the collection once we know it is safe to do so
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070306/281d73d5/attachment.html
More information about the calendarserver-changes
mailing list