[CalendarServer-changes] [4694] CalendarServer/branches/more-deferreds-4/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 2 14:44:58 PST 2009


Revision: 4694
          http://trac.macosforge.org/projects/calendarserver/changeset/4694
Author:   glyph at apple.com
Date:     2009-11-02 14:44:55 -0800 (Mon, 02 Nov 2009)
Log Message:
-----------
tweaks, minor fixes, and debuggability improvements derived from CalDAVTester runs

Modified Paths:
--------------
    CalendarServer/branches/more-deferreds-4/twistedcaldav/directory/wiki.py
    CalendarServer/branches/more-deferreds-4/twistedcaldav/dropbox.py
    CalendarServer/branches/more-deferreds-4/twistedcaldav/method/put_common.py
    CalendarServer/branches/more-deferreds-4/twistedcaldav/resource.py

Modified: CalendarServer/branches/more-deferreds-4/twistedcaldav/directory/wiki.py
===================================================================
--- CalendarServer/branches/more-deferreds-4/twistedcaldav/directory/wiki.py	2009-11-02 21:47:40 UTC (rev 4693)
+++ CalendarServer/branches/more-deferreds-4/twistedcaldav/directory/wiki.py	2009-11-02 22:44:55 UTC (rev 4694)
@@ -28,7 +28,7 @@
 from twisted.web2.http import HTTPError, StatusResponse
 from twisted.web2.auth.wrapper import UnauthorizedResponse
 
-from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.internet.defer import inlineCallbacks, returnValue, succeed
 
 
 from twisted.web2.dav.resource import TwistedACLInheritable

Modified: CalendarServer/branches/more-deferreds-4/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/branches/more-deferreds-4/twistedcaldav/dropbox.py	2009-11-02 21:47:40 UTC (rev 4693)
+++ CalendarServer/branches/more-deferreds-4/twistedcaldav/dropbox.py	2009-11-02 22:44:55 UTC (rev 4694)
@@ -21,7 +21,6 @@
 __all__ = [
     "DropBoxHomeResource",
     "DropBoxCollectionResource",
-    "DropBoxChildResource",
 ]
 
 from twisted.internet.defer import succeed
@@ -79,7 +78,7 @@
                 edited_aces.append(ace)
         
         # Do inherited with possibly modified set of aces
-        super(DropBoxCollectionResource, self).writeNewACEs(edited_aces)
+        return super(DropBoxCollectionResource, self).writeNewACEs(edited_aces)
 
     def http_PUT(self, request):
         return ErrorResponse(

Modified: CalendarServer/branches/more-deferreds-4/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/branches/more-deferreds-4/twistedcaldav/method/put_common.py	2009-11-02 21:47:40 UTC (rev 4693)
+++ CalendarServer/branches/more-deferreds-4/twistedcaldav/method/put_common.py	2009-11-02 22:44:55 UTC (rev 4694)
@@ -27,7 +27,7 @@
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet import reactor
-from twisted.internet.defer import Deferred, inlineCallbacks, succeed
+from twisted.internet.defer import Deferred, maybeDeferred, inlineCallbacks
 from twisted.internet.defer import returnValue
 from twisted.python import failure
 from twisted.python.filepath import FilePath
@@ -307,7 +307,7 @@
             if not self.sourcecal:
                 # Valid content type check on the source resource if its not in a calendar collection
                 if self.source is not None:
-                    result, message = self.validContentType()
+                    result, message = yield self.validContentType()
                     if not result:
                         log.err(message)
                         raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "supported-calendar-data")))
@@ -445,17 +445,22 @@
         
     def validContentType(self):
         """
-        Make sure that the content-type of the source resource is text/calendar.
-        This test is only needed when the source is not in a calendar collection.
+        Make sure that the content-type of the source resource is
+        text/calendar.  This test is only needed when the source is not in a
+        calendar collection.
         """
         result = True
         message = ""
-        content_type = self.source.contentType()
-        if not ((content_type.mediaType == "text") and (content_type.mediaSubtype == "calendar")):
+        content_type = yield maybeDeferred(self.source.contentType)
+        if (content_type is None or
+            not ((content_type.mediaType == "text") and
+                 (content_type.mediaSubtype == "calendar"))):
             result = False
-            message = "MIME type %s not allowed in calendar collection" % (content_type,)
+            message = "MIME type %s not allowed in calendar collection" % (
+                content_type,
+            )
 
-        return result, message
+        returnValue((result, message))
         
     def validContentLength(self):
         """
@@ -1129,4 +1134,4 @@
                         NumberOfRecurrencesWithinLimits(PCDATAElement(str(err.max_allowed)))
                     ))
             else:
-                raise err
+                raise

Modified: CalendarServer/branches/more-deferreds-4/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/more-deferreds-4/twistedcaldav/resource.py	2009-11-02 21:47:40 UTC (rev 4693)
+++ CalendarServer/branches/more-deferreds-4/twistedcaldav/resource.py	2009-11-02 22:44:55 UTC (rev 4694)
@@ -701,6 +701,8 @@
             result.append(davxml.Report(caldavxml.FreeBusyQuery(),))
         return result
 
+
+    @inlineCallbacks
     def writeNewACEs(self, newaces):
         """
         Write a new ACL to the resource's property store. We override this for calendar collections
@@ -726,7 +728,7 @@
             edited_aces = newaces
 
         # Do inherited with possibly modified set of aces
-        super(CalDAVResource, self).writeNewACEs(edited_aces)
+        returnValue((yield maybeDeferred(super(CalDAVResource, self).writeNewACEs, edited_aces)))
 
     ##
     # Utilities
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091102/4610448e/attachment.html>


More information about the calendarserver-changes mailing list