[CalendarServer-changes] [2501] CalendarServer/trunk/twistedcaldav/itip.py

source_changes at macosforge.org source_changes at macosforge.org
Sun May 25 18:22:57 PDT 2008


Revision: 2501
          http://trac.macosforge.org/projects/calendarserver/changeset/2501
Author:   wsanchez at apple.com
Date:     2008-05-25 18:22:56 -0700 (Sun, 25 May 2008)

Log Message:
-----------
Ixnay on the eferredGeneratorsday

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/itip.py

Modified: CalendarServer/trunk/twistedcaldav/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/itip.py	2008-05-25 22:20:33 UTC (rev 2500)
+++ CalendarServer/trunk/twistedcaldav/itip.py	2008-05-26 01:22:56 UTC (rev 2501)
@@ -35,7 +35,6 @@
 import time
 
 from twisted.python.failure import Failure
-from twisted.internet.defer import waitForDeferred, deferredGenerator
 from twisted.internet.defer import inlineCallbacks, returnValue, maybeDeferred
 from twisted.web2.dav import davxml
 from twisted.web2.dav.method.report import NumberOfMatchesWithinLimits
@@ -537,6 +536,7 @@
 
     returnValue((rsvp, replycal, accepted))
 
+ at inlineCallbacks
 def writeReply(request, principal, replycal, ainbox):
     """
     Write an iTIP message reply into the specified Inbox.
@@ -554,26 +554,18 @@
     assert inboxURL
     
     # Determine whether current principal has CALDAV:schedule right on that Inbox
-    inbox = waitForDeferred(request.locateResource(inboxURL))
-    yield inbox
-    inbox = inbox.getResult()
+    inbox = yield request.locateResource(inboxURL)
 
     try:
-        d = waitForDeferred(inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL()))))
-        yield d
-        d.getResult()
+        yield inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL())))
     except AccessDeniedError:
         log.info("Could not send reply as %s does not have CALDAV:schedule permission on %s Inbox." % (principal.principalURL(), organizer))
-        yield None
-        return
+        returnValue(None)
     
     # Now deposit the new calendar into the inbox
-    d = waitForDeferred(writeResource(request, inboxURL, inbox, None, replycal))
-    yield d
-    yield d.getResult()
+    result = yield writeResource(request, inboxURL, inbox, None, replycal)
+    returnValue(result)
 
-writeReply = deferredGenerator(writeReply)
-
 @inlineCallbacks
 def writeResource(request, collURL, collection, name, calendar):
     """

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080525/92e40d71/attachment.htm 


More information about the calendarserver-changes mailing list