[CalendarServer-changes] [3787] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 3 09:34:22 PST 2009
Revision: 3787
http://trac.macosforge.org/projects/calendarserver/changeset/3787
Author: cdaboo at apple.com
Date: 2009-03-03 09:34:21 -0800 (Tue, 03 Mar 2009)
Log Message:
-----------
Handle RRULE value part re-ordering.
Modified Paths:
--------------
CalendarServer/trunk/run
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run 2009-03-03 17:33:00 UTC (rev 3786)
+++ CalendarServer/trunk/run 2009-03-03 17:34:21 UTC (rev 3787)
@@ -707,7 +707,7 @@
caldavtester="${top}/CalDAVTester";
-svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3780;
+svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3786;
#
# PyFlakes
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2009-03-03 17:33:00 UTC (rev 3786)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2009-03-03 17:34:21 UTC (rev 3787)
@@ -1717,7 +1717,7 @@
if normalize_function:
prop.setValue(normalize_function(prop.value()))
- # Do datetime normalization
+ # Do datetime/rrule normalization
self.normalizeDateTimes()
# Do to all sub-components too
@@ -1729,11 +1729,16 @@
Normalize various datetime properties into UTC and handle DTEND/DURATION variants in such
a way that we can compare objects with slight differences.
+ Also normalize the RRULE value parts.
+
Strictly speaking we should not need to do this as clients should not be messing with
these properties - i.e. they should roundtrip them. Unfortunately some do...
"""
+ # TODO: what about VJOURNAL and VTODO?
if self.name() == "VEVENT":
+
+ # Basic time properties
dtstart = self.getProperty("DTSTART")
dtend = self.getProperty("DTEND")
duration = self.getProperty("DURATION")
@@ -1775,6 +1780,14 @@
except KeyError:
pass
+ # Recurrence rules - we need to normalize the order of the value parts
+ rrules = self.properties("RRULE")
+ for rrule in rrules:
+ indexedTokens = {}
+ indexedTokens.update([valuePart.split("=") for valuePart in rrule.value().split(";")])
+ sortedValue = ";".join(["%s=%s" % (key, value,) for key, value in sorted(indexedTokens.iteritems(), key=lambda x:x[0])])
+ rrule.setValue(sortedValue)
+
def normalizePropertyValueLists(self, propname):
"""
Convert properties that have a list of values into single properties, to make it easier
Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py 2009-03-03 17:33:00 UTC (rev 3786)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py 2009-03-03 17:34:21 UTC (rev 3787)
@@ -2015,6 +2015,40 @@
END:VCALENDAR
""",
),
+ (
+ "1.3",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART;VALUE=DATE-TIME:20071114T000000Z
+RRULE:FREQ=WEEKLY;WKST=SU;INTERVAL=1;BYDAY=MO,WE,FR
+TRANSP:OPAQUE
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user03 at example.com
+ATTENDEE;RSVP=FALSE:mailto:user04 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;RSVP=TRUE:mailto:user02 at example.com
+ATTENDEE:mailto:user03 at example.com
+ATTENDEE:mailto:user04 at example.com
+RRULE:BYDAY=MO,WE,FR;FREQ=WEEKLY;INTERVAL=1;WKST=SU
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
)
for title, original, result in data:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090303/1d6f983e/attachment.html>
More information about the calendarserver-changes
mailing list