[CalendarServer-changes] [13142] CalendarServer/branches/users/sagen/move2who-4

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 3 10:08:07 PDT 2014


Revision: 13142
          http://trac.calendarserver.org//changeset/13142
Author:   sagen at apple.com
Date:     2014-04-03 10:08:07 -0700 (Thu, 03 Apr 2014)
Log Message:
-----------
pull over r13137 from trunk to match new PyCalendar

Revision Links:
--------------
    http://trac.calendarserver.org//changeset/13137

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ical.py
    CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/storebridge.py
    CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_icaldiff.py
    CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_implicit.py

Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ical.py	2014-04-03 13:14:03 UTC (rev 13141)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ical.py	2014-04-03 17:08:07 UTC (rev 13142)
@@ -3494,10 +3494,10 @@
     start.setDateOnly(False)
     if tzexpanded:
         if start != tzexpanded[0][0]:
-            results.append((str(start), UTCOffsetValue(tzexpanded[0][1]).getText(),))
+            results.append((str(start), UTCOffsetValue(tzexpanded[0][2]).getText(),))
     else:
         results.append((str(start), UTCOffsetValue(tzcomp._pycalendar.getTimezoneOffsetSeconds(start)).getText(),))
-    for tzstart, _ignore_tzoffsetfrom, tzoffsetto in tzexpanded:
+    for tzstart, _ignore_utctzstart, _ignore_tzoffsetfrom, tzoffsetto in tzexpanded:
         results.append((
             tzstart.getText(),
             UTCOffsetValue(tzoffsetto).getText(),
@@ -3541,9 +3541,9 @@
         if start != tzexpanded[0][0]:
             results.append((
                 start,
-                tzexpanded[0][1],
-                tzexpanded[0][1],
-                tzexpanded[0][3],
+                tzexpanded[0][2],
+                tzexpanded[0][2],
+                tzexpanded[0][4],
             ))
     else:
         results.append((
@@ -3552,7 +3552,7 @@
             tzcomp._pycalendar.getTimezoneOffsetSeconds(start),
             tzcomp._pycalendar.getTimezoneDescriptor(start),
         ))
-    for tzstart, tzoffsetfrom, tzoffsetto, name in tzexpanded:
+    for tzstart, _ignore_utctzstart, tzoffsetfrom, tzoffsetto, name in tzexpanded:
         results.append((
             tzstart,
             tzoffsetfrom,

Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/storebridge.py	2014-04-03 13:14:03 UTC (rev 13141)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/storebridge.py	2014-04-03 17:08:07 UTC (rev 13142)
@@ -3987,7 +3987,7 @@
                     customxml.CommonName.fromString(commonName) if commonName else None,
                     # customxml.FirstNameProperty(record.firstName) if record.firstName else None,
                     # customxml.LastNameProperty(record.lastName) if record.lastName else None,
-                    #**typeAttr
+                    **typeAttr
                 ),
             )
         else:

Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_icaldiff.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_icaldiff.py	2014-04-03 13:14:03 UTC (rev 13141)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_icaldiff.py	2014-04-03 17:08:07 UTC (rev 13142)
@@ -20,6 +20,7 @@
 
 from twistedcaldav.stdconfig import config
 from twistedcaldav.ical import Component
+from twistedcaldav.timezones import TimezoneCache
 
 from txdav.caldav.datastore.scheduling.icaldiff import iCalDiff
 
@@ -3273,6 +3274,240 @@
             self.assertEqual(diffResult, result, msg="%s: actual result: (%s)" % (description, ", ".join([str(i).replace("\r", "") for i in diffResult]),))
 
 
+    def test_attendee_merge_timezonedst(self):
+
+        data = (
+            (
+                "#1.1",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+DTSTART;TZID=America/Los_Angeles:20140302T190000
+DTEND;TZID=America/Los_Angeles:20140302T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140303T190000
+DTSTART;TZID=America/Los_Angeles:20140303T190000
+DTEND;TZID=America/Los_Angeles:20140303T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140304T190000
+DTSTART;TZID=America/Los_Angeles:20140305T190000
+DTEND;TZID=America/Los_Angeles:20140305T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140305T190000
+DTSTART;TZID=America/Los_Angeles:20140304T190000
+DTEND;TZID=America/Los_Angeles:20140304T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140307T190000
+DTSTART;TZID=America/Los_Angeles:20140307T190000
+DTEND;TZID=America/Los_Angeles:20140307T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+DTSTART;TZID=America/Los_Angeles:20140302T190000
+DTEND;TZID=America/Los_Angeles:20140302T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140303T190000
+DTSTART;TZID=America/Los_Angeles:20140303T190000
+DTEND;TZID=America/Los_Angeles:20140303T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140304T190000
+DTSTART;TZID=America/Los_Angeles:20140305T190000
+DTEND;TZID=America/Los_Angeles:20140305T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140305T190000
+DTSTART;TZID=America/Los_Angeles:20140304T190000
+DTEND;TZID=America/Los_Angeles:20140304T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140307T190000
+DTSTART;TZID=America/Los_Angeles:20140307T190000
+DTEND;TZID=America/Los_Angeles:20140307T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140308T190000
+DTSTART;TZID=America/Los_Angeles:20140308T190000
+DTEND;TZID=America/Los_Angeles:20140308T193000
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=DECLINED:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                "mailto:user2 at example.com",
+                (True, True, ('20140309T030000Z',), """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+DTSTART;TZID=America/Los_Angeles:20140302T190000
+DTEND;TZID=America/Los_Angeles:20140302T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140303T190000
+DTSTART;TZID=America/Los_Angeles:20140303T190000
+DTEND;TZID=America/Los_Angeles:20140303T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140304T190000
+DTSTART;TZID=America/Los_Angeles:20140305T190000
+DTEND;TZID=America/Los_Angeles:20140305T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140305T190000
+DTSTART;TZID=America/Los_Angeles:20140304T190000
+DTEND;TZID=America/Los_Angeles:20140304T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140307T190000
+DTSTART;TZID=America/Los_Angeles:20140307T190000
+DTEND;TZID=America/Los_Angeles:20140307T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:252ECE12-3C4F-4895-8AE6-EB45DC9156D2
+RECURRENCE-ID;TZID=America/Los_Angeles:20140308T190000
+DTSTART;TZID=America/Los_Angeles:20140308T190000
+DTEND;TZID=America/Los_Angeles:20140308T193000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=DECLINED;RSVP=TRUE;X-CALENDARSERVER-DTSTAMP=XXXXXXXXTXXXXXXZ:mailto:user2 at example.com
+DTSTAMP:20140307T052759Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""")
+            ),
+        )
+
+        TimezoneCache.create()
+        for description, calendar1, calendar2, attendee, result in data:
+            differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2), False)
+            diffResult = differ.attendeeMerge(attendee)
+            diffResult = (
+                diffResult[0],
+                diffResult[1],
+                tuple(sorted(diffResult[2])),
+                re.sub(
+                    "X-CALENDARSERVER-DTSTAMP=[^Z]+",
+                    "X-CALENDARSERVER-DTSTAMP=XXXXXXXXTXXXXXX",
+                    str(diffResult[3]).replace("\r", "").replace("\n ", "")
+                ) if diffResult[3] else None,
+            )
+            result = list(result)
+            result[2] = tuple([(DateTime.parseText(dt) if dt else None) for dt in result[2]])
+            result = tuple(result)
+            self.assertEqual(diffResult, result, msg="%s: actual result: (%s)" % (description, ", ".join([str(i).replace("\r", "") for i in diffResult]),))
+
+
     def test_what_is_different(self):
 
         data1 = (

Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_implicit.py	2014-04-03 13:14:03 UTC (rev 13141)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/test/test_implicit.py	2014-04-03 17:08:07 UTC (rev 13142)
@@ -28,6 +28,7 @@
 
 from twistedcaldav.config import config
 from twistedcaldav.ical import Component
+from twistedcaldav.timezones import TimezoneCache
 
 from txdav.caldav.datastore.scheduling.implicit import ImplicitScheduler, \
     ScheduleReplyWork
@@ -1575,3 +1576,67 @@
             self.assertTrue("PARTSTAT=ACCEPTED" in calendar3)
 
         yield deferLater(reactor, 2.0, _test_user03_refresh)
+
+
+    @inlineCallbacks
+    def test_doImplicitScheduling_OrganizerEventTimezoneDST(self):
+        """
+        Test that doImplicitScheduling delivers scheduling messages to attendees. This test
+        creates an exception close to a DST transition to make sure timezone DST handling
+        is correct.
+        """
+
+        data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART;TZID=America/Los_Angeles:20140302T190000
+DTEND;TZID=America/Los_Angeles:20140302T193000
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+        data2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART;TZID=America/Los_Angeles:20140302T190000
+DTEND;TZID=America/Los_Angeles:20140302T193000
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+RECURRENCE-ID;TZID=America/Los_Angeles:20140308T190000
+DTSTART;TZID=America/Los_Angeles:20140308T190000
+DTEND;TZID=America/Los_Angeles:20140308T193000
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+        TimezoneCache.create()
+
+        yield self._createCalendarObject(data1, "user01", "test.ics")
+
+        yield self._setCalendarData(data2, "user01", "test.ics")
+
+        list2 = (yield self._listCalendarObjects("user02"))
+        self.assertEqual(len(list2), 1)
+        self.assertTrue(list2[0].startswith(hashlib.md5("12345-67890").hexdigest()))
+
+        list2 = (yield self._listCalendarObjects("user02", "inbox"))
+        self.assertEqual(len(list2), 2)
+        self.assertTrue(list2[0].startswith(hashlib.md5("12345-67890").hexdigest()))
+        self.assertTrue(list2[1].startswith(hashlib.md5("12345-67890").hexdigest()))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140403/f79a6c34/attachment-0001.html>


More information about the calendarserver-changes mailing list