[CalendarServer-changes] [2850] CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Sun Aug 24 10:21:41 PDT 2008
Revision: 2850
http://trac.macosforge.org/projects/calendarserver/changeset/2850
Author: cdaboo at apple.com
Date: 2008-08-24 10:21:41 -0700 (Sun, 24 Aug 2008)
Log Message:
-----------
REQUEST-STATUS is needed in iTIP REPLY's.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/ical.py
CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py
CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_icalendar.py
Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/ical.py 2008-08-24 17:20:49 UTC (rev 2849)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/ical.py 2008-08-24 17:21:41 UTC (rev 2850)
@@ -1246,7 +1246,20 @@
for property in component.properties(propname):
if property.value() == propvalue:
property.params()[paramname] = [paramvalue]
-
+
+ def addPropertyToAllComponents(self, property):
+ """
+ Add a property to all top-level components except VTIMEZONE.
+
+ @param property: the property to add
+ @type property: L{Property}
+ """
+
+ for component in self.subcomponents():
+ if component.name() == "VTIMEZONE":
+ continue
+ component.addProperty(property)
+
def attendeesView(self, attendees):
"""
Filter out any components that all attendees are not present in. Use EXDATEs
Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py 2008-08-24 17:20:49 UTC (rev 2849)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py 2008-08-24 17:21:41 UTC (rev 2850)
@@ -392,6 +392,8 @@
else:
attendeeProp.params()["PARTSTAT"] = ["DECLINED"]
+ # Add REQUEST-STATUS to each top-level component
+ itip.addPropertyToAllComponents(Property("REQUEST-STATUS", "2.0;Success"))
return itip
@staticmethod
Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_icalendar.py 2008-08-24 17:20:49 UTC (rev 2849)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_icalendar.py 2008-08-24 17:21:41 UTC (rev 2850)
@@ -21,7 +21,7 @@
from twisted.trial.unittest import SkipTest
from twistedcaldav.ical import Component, parse_date, parse_datetime,\
- parse_date_or_datetime, parse_duration
+ parse_date_or_datetime, parse_duration, Property
import twistedcaldav.test.util
from vobject.icalendar import utc
@@ -581,6 +581,72 @@
component.setParameterToValueForPropertyWithValue(*args)
self.assertEqual(result, str(component).replace("\r", ""))
+ def test_add_property(self):
+ data = (
+ # Simple component
+ (
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+REQUEST-STATUS:2.0\;Success
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ # Complex component
+ (
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T020000Z
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//PYVOBJECT//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+REQUEST-STATUS:2.0\;Success
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T020000Z
+REQUEST-STATUS:2.0\;Success
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ )
+
+ for original, result in data:
+ component = Component.fromString(original)
+ component.addPropertyToAllComponents(Property("REQUEST-STATUS", "2.0;Success"))
+ self.assertEqual(result, str(component).replace("\r", ""))
+
def test_attendees_views(self):
data = (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080824/96ebd1cd/attachment-0001.html
More information about the calendarserver-changes
mailing list