[CalendarServer-changes] [189]
CalendarServer/branches/users/cdaboo/quota/twistedcaldav/itip.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 25 08:16:25 PDT 2006
Revision: 189
http://trac.macosforge.org/projects/calendarserver/changeset/189
Author: cdaboo at apple.com
Date: 2006-09-25 08:16:24 -0700 (Mon, 25 Sep 2006)
Log Message:
-----------
Must use locateResource - not direct creation of CalDAVFile in order for new resource URI to be registered.
Clean-up some deferreds.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/quota/twistedcaldav/itip.py
Modified: CalendarServer/branches/users/cdaboo/quota/twistedcaldav/itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/quota/twistedcaldav/itip.py 2006-09-22 20:38:58 UTC (rev 188)
+++ CalendarServer/branches/users/cdaboo/quota/twistedcaldav/itip.py 2006-09-25 15:16:24 UTC (rev 189)
@@ -634,9 +634,12 @@
# Create a new name if one was not provided
if name is None:
name = md5.new(str(calendar) + str(time.time()) + collection.fp.path).hexdigest() + ".ics"
- newchild = CalDAVFile(os.path.join(collection.fp.path, name))
- else:
- newchild = collection.getChild(name)
+
+ # Get a resource for the new item
+ newchildURL = joinURL(collURL, name)
+ newchild = waitForDeferred(request.locateResource(newchildURL))
+ yield newchild
+ newchild = newchild.getResult()
# Modify the original calendar data by removing the METHOD property - everything else is left as-is,
# as any other needed changes (e.g. RSVP/PARTSTAT) will have been updated.
@@ -648,29 +651,26 @@
itipper = False
# Now write it to the resource
-
- # Get a resource for the new item
- newchildURL = joinURL(collURL, name)
+ try:
+ d = waitForDeferred(storeCalendarObjectResource(
+ request=request,
+ sourcecal = False,
+ destination = newchild,
+ destination_uri = newchildURL,
+ calendardata = str(calendar),
+ destinationparent = collection,
+ destinationcal = True,
+ isiTIP = itipper
+ ))
+ yield d
+ d.getResult()
+ except:
+ yield None
+ return
- # Copy calendar to inbox (doing fan-out)
- def _defer(result):
- return newchild
- def _deferErr(f):
- return None
+ yield newchild
- d = maybeDeferred(
- storeCalendarObjectResource,
- request=request,
- sourcecal = False,
- destination = newchild,
- destination_uri = newchildURL,
- calendardata = str(calendar),
- destinationparent = collection,
- destinationcal = True,
- isiTIP = itipper
- )
- d.addCallbacks(_defer, _deferErr)
- return d
+writeResource = deferredGenerator(writeResource)
def newInboxResource(child, newchild):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060925/8b0693df/attachment.html
More information about the calendarserver-changes
mailing list