[CalendarServer-changes] [13338] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sat Apr 19 09:02:21 PDT 2014


Revision: 13338
          http://trac.calendarserver.org//changeset/13338
Author:   cdaboo at apple.com
Date:     2014-04-19 09:02:21 -0700 (Sat, 19 Apr 2014)
Log Message:
-----------
Make sure group attendee changes always trigger implicit scheduling. Fix a few related tests.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/ical.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/who/groups.py
    CalendarServer/trunk/txdav/who/test/test_group_attendees.py

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2014-04-19 14:31:27 UTC (rev 13337)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2014-04-19 16:02:21 UTC (rev 13338)
@@ -3411,7 +3411,7 @@
             memberCUAs = set()
             for newAttendeeProp in memberAtttendeeProps:
                 memberCUA = newAttendeeProp.value()
-                if newAttendeeProp.value() not in oldAttendeeCUAs:
+                if memberCUA not in oldAttendeeCUAs:
                     component.addProperty(newAttendeeProp)
                     changed = True
                 memberCUAs.add(memberCUA)

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2014-04-19 14:31:27 UTC (rev 13337)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2014-04-19 16:02:21 UTC (rev 13338)
@@ -508,20 +508,32 @@
                 "Only one organizer allowed in scheduling object resource",
             ))
 
+        # Attendee details
+        yield self.extractAttendees()
+
+        # Some other useful things
+        self.uid = self.calendar.resourceUID()
+        self.instances = set(self.calendar.getComponentInstances())
+
+
+    @inlineCallbacks
+    def extractAttendees(self):
+        """
+        Extract details about the attendees from the new calendar data. We do this
+        in its own method because we might need to refresh this information if the attendee
+        list changes after a test_X call but before scheduling itself needs to happen. That
+        can occur when group attendee reconciliation occurs.
+        """
         # Coerce any local with SCHEDULE-AGENT=CLIENT
         yield self.coerceAttendeeScheduleAgent()
 
         # Get the ATTENDEEs
         self.attendeesByInstance = self.calendar.getAttendeesByInstance(True, onlyScheduleAgentServer=True)
-        self.instances = set(self.calendar.getComponentInstances())
         self.attendees = set()
         for attendee, _ignore in self.attendeesByInstance:
             self.attendees.add(attendee)
 
-        # Some other useful things
-        self.uid = self.calendar.resourceUID()
 
-
     @inlineCallbacks
     def hasCalendarResourceUIDSomewhereElse(self, check_resource, mode):
         """

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2014-04-19 14:31:27 UTC (rev 13337)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2014-04-19 16:02:21 UTC (rev 13338)
@@ -2447,7 +2447,9 @@
 
             # group attendees
             if scheduler.state == "organizer":
-                yield self.reconcileGroupAttendees(component, inserting)
+                changed = yield self.reconcileGroupAttendees(component, inserting)
+                if changed:
+                    yield scheduler.extractAttendees()
 
             # Set an attribute on this object to indicate that it is valid to check for an event split. We need to do this here so that if a timeout
             # occurs whilst doing implicit processing (most likely because the event is too big) we are able to subsequently detect that it is OK

Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py	2014-04-19 14:31:27 UTC (rev 13337)
+++ CalendarServer/trunk/txdav/who/groups.py	2014-04-19 16:02:21 UTC (rev 13338)
@@ -182,7 +182,7 @@
         component = component.duplicate()
 
         # sync group attendees
-        if calendarObject.reconcileGroupAttendees(component):
+        if (yield calendarObject.reconcileGroupAttendees(component)):
             yield calendarObject.setComponent(component)
 
 

Modified: CalendarServer/trunk/txdav/who/test/test_group_attendees.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-19 14:31:27 UTC (rev 13337)
+++ CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-19 16:02:21 UTC (rev 13338)
@@ -444,6 +444,24 @@
 END:VCALENDAR
 """
 
+        data_get_4 = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+BEGIN:VEVENT
+UID:event1 at ninevah.local
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+ATTENDEE;CN=User 02;EMAIL=user02 at example.com;RSVP=TRUE:urn:x-uid:10000000-0000-0000-0000-000000000002
+ATTENDEE;CN=Group 01;CUTYPE=GROUP;EMAIL=group01 at example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:x-uid:20000000-0000-0000-0000-000000000001
+CREATED:20060101T150000Z
+ORGANIZER;CN=User 02;EMAIL=user02 at example.com:urn:x-uid:10000000-0000-0000-0000-000000000002
+SEQUENCE:2
+SUMMARY:event 1
+END:VEVENT
+END:VCALENDAR
+"""
+
         @inlineCallbacks
         def expandedMembers(self, records=None):
             yield None
@@ -490,7 +508,7 @@
 
         cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="10000000-0000-0000-0000-000000000002")
         vcalendar3 = yield cobj1.component()
-        self.assertEqual(normalize_iCalStr(vcalendar3), normalize_iCalStr(data_get_2))
+        self.assertEqual(normalize_iCalStr(vcalendar3), normalize_iCalStr(data_get_4))
 
         cal1 = yield self.calendarUnderTest(name="calendar", home="10000000-0000-0000-0000-000000000001")
         cobjs = yield cal1.objectResources()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140419/3f120307/attachment.html>


More information about the calendarserver-changes mailing list