[CalendarServer-changes] [8627] CalendarServer/trunk/twistedcaldav/method/put_common.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 3 16:22:29 PST 2012
Revision: 8627
http://trac.macosforge.org/projects/calendarserver/changeset/8627
Author: cdaboo at apple.com
Date: 2012-02-03 16:22:29 -0800 (Fri, 03 Feb 2012)
Log Message:
-----------
Handle clients adding/removing COMPLETED but not adjusting PARTSTAT accordingly.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/method/put_common.py
Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py 2012-02-04 00:18:55 UTC (rev 8626)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py 2012-02-04 00:22:29 UTC (rev 8627)
@@ -698,6 +698,9 @@
new_attendees = self.calendar.getAttendees()
old_attendees = tuple(old_calendar.getAllAttendeeProperties())
+ new_completed = self.calendar.mainComponent().hasProperty("COMPLETED")
+ old_completed = old_calendar.mainComponent().hasProperty("COMPLETED")
+
if old_organizer and not new_organizer and len(old_attendees) > 0 and len(new_attendees) == 0:
# Transfer old organizer and attendees to new calendar
log.debug("Organizer and attendee properties were entirely removed by the client. Restoring existing properties.")
@@ -730,6 +733,38 @@
self.calendardata = None
+ elif new_completed ^ old_completed and not self.internal_request:
+ # COMPLETED changed - sync up attendee state
+ # We need this because many VTODO clients are not aware of scheduling,
+ # i.e. they do not adjust any ATTENDEE PARTSTATs. We are going to impose
+ # our own requirement that PARTSTAT is set to COMPLETED when the COMPLETED
+ # property is added.
+
+ # Transfer old organizer and attendees to new calendar
+ log.debug("Sync COMPLETED property change.")
+
+ # Get the originator who is the owner of the calendar resource being modified
+ originatorPrincipal = (yield self.destination.ownerPrincipal(self.request))
+ originatorAddresses = originatorPrincipal.calendarUserAddresses()
+
+ changed = False
+ for component in self.calendar.subcomponents():
+ if component.name() != "VTODO":
+ continue
+
+ # Change owner partstat
+ for anAttendee in component.properties("ATTENDEE"):
+ if anAttendee.value() in originatorAddresses:
+ oldpartstat = anAttendee.parameterValue("PARTSTAT", "NEEDS-ACTION")
+ newpartstat = "COMPLETED" if component.hasProperty("COMPLETED") else "IN-PROCESS"
+ if newpartstat != oldpartstat:
+ anAttendee.setParameter("PARTSTAT", newpartstat)
+ changed = True
+
+ if changed:
+ self.calendardata = None
+
+
@inlineCallbacks
def dropboxPathNormalization(self):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120203/def6e16c/attachment.html>
More information about the calendarserver-changes
mailing list