[CalendarServer-changes] [9974] CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 23 13:20:36 PDT 2012
Revision: 9974
http://trac.calendarserver.org//changeset/9974
Author: cdaboo at apple.com
Date: 2012-10-23 13:20:36 -0700 (Tue, 23 Oct 2012)
Log Message:
-----------
Fix for correct PARTSTAT updating when attendee overrides an instance.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2012-10-23 20:13:16 UTC (rev 9973)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2012-10-23 20:20:36 UTC (rev 9974)
@@ -812,16 +812,18 @@
# Test/fix ones removed
for rid in valid_old_rids:
- # Compare the old one to the new master
- # Note it is hard to recover from this state so raise instead
- self.compareAttendeePartstats(
+ # Compare the old one to a derived instance, and if there is a change
+ # add the derived instance to the new data
+ newcomp = self.calendar.deriveInstance(rid)
+ changed = self.compareAttendeePartstats(
self.oldcalendar.overriddenComponent(rid),
- self.calendar.overriddenComponent(None),
- raiseOnMisMatch=True
+ newcomp,
)
+ if changed:
+ self.calendar.addComponent(newcomp)
- def compareAttendeePartstats(self, old_component, new_component, raiseOnMisMatch=False):
+ def compareAttendeePartstats(self, old_component, new_component):
"""
Compare two components, old and new, and make sure the Organizer has not changed the PARTSTATs
in the new one to anything other than NEEDS-ACTION. If there is a change, undo it.
@@ -830,6 +832,7 @@
old_attendees = dict([(normalizeCUAddr(attendee.value()), attendee) for attendee in old_component.getAllAttendeeProperties()])
new_attendees = dict([(normalizeCUAddr(attendee.value()), attendee) for attendee in new_component.getAllAttendeeProperties()])
+ changed = False
for cuaddr, newattendee in new_attendees.items():
# Don't adjust ORGANIZER's ATTENDEE
if newattendee.value() in self.organizerPrincipal.calendarUserAddresses():
@@ -839,16 +842,12 @@
old_attendee = old_attendees.get(cuaddr)
old_partstat = old_attendee.parameterValue("PARTSTAT", "NEEDS-ACTION").upper() if old_attendee else "NEEDS-ACTION"
if old_attendee is None or old_partstat != new_partstat:
- if raiseOnMisMatch:
- raise HTTPError(ErrorResponse(
- responsecode.FORBIDDEN,
- (caldav_namespace, "valid-organizer-change"),
- "Organizer cannot change Attendee PARTSTAT",
- ))
- else:
- newattendee.setParameter("PARTSTAT", old_partstat)
+ newattendee.setParameter("PARTSTAT", old_partstat)
+ changed = True
+ return changed
+
@inlineCallbacks
def scheduleWithAttendees(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121023/43299923/attachment.html>
More information about the calendarserver-changes
mailing list