[CalendarServer-changes] [8716] CalendarServer/trunk/twistedcaldav/scheduling
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 16 10:42:44 PST 2012
Revision: 8716
http://trac.macosforge.org/projects/calendarserver/changeset/8716
Author: sagen at apple.com
Date: 2012-02-16 10:42:43 -0800 (Thu, 16 Feb 2012)
Log Message:
-----------
When generating itip replies, remove components which are missing the ATTENDEE
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/scheduling/itip.py
CalendarServer/trunk/twistedcaldav/scheduling/test/test_itip.py
Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py 2012-02-16 18:23:26 UTC (rev 8715)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py 2012-02-16 18:42:43 UTC (rev 8716)
@@ -717,7 +717,12 @@
# Remove all attendees except the one we want
itip.removeAllButOneAttendee(attendee)
-
+
+ # Remove all components which are missing the attendee
+ for component in itip.subcomponents():
+ if not component.getAttendeeProperty((attendee,)):
+ itip.removeComponent(component)
+
# No alarms
itip.removeAlarms()
Modified: CalendarServer/trunk/twistedcaldav/scheduling/test/test_itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/test/test_itip.py 2012-02-16 18:23:26 UTC (rev 8715)
+++ CalendarServer/trunk/twistedcaldav/scheduling/test/test_itip.py 2012-02-16 18:42:43 UTC (rev 8716)
@@ -1902,3 +1902,89 @@
itipped = str(itipped).replace("\r", "")
itipped = "".join([line for line in itipped.splitlines(True) if not line.startswith("DTSTAMP:")])
self.assertEqual(filtered, itipped)
+
+ def test_missingAttendee(self):
+ """
+ When generating a reply, remove all components that are missing
+ the ATTENDEE
+ """
+
+ original = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:America/Los_Angeles
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0800
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+DTSTART:20070311T020000
+TZNAME:PDT
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0700
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+DTSTART:20071104T020000
+TZNAME:PST
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:04405DDD-C938-46FC-A4CE-8573613BEA39
+DTEND;TZID=America/Los_Angeles:20100826T130000
+TRANSP:TRANSPARENT
+SUMMARY:Missing attendee in master
+DTSTART;TZID=America/Los_Angeles:20100826T130000
+DTSTAMP:20101115T160533Z
+ORGANIZER;CN="The Organizer":mailto:organizer at example.com
+SEQUENCE:0
+END:VEVENT
+BEGIN:VEVENT
+DTEND;TZID=America/Los_Angeles:20101007T120000
+TRANSP:OPAQUE
+UID:04405DDD-C938-46FC-A4CE-8573613BEA39
+DTSTAMP:20101005T213326Z
+X-APPLE-NEEDS-REPLY:TRUE
+SEQUENCE:24
+RECURRENCE-ID;TZID=America/Los_Angeles:20100826T130000
+SUMMARY:Missing attendee in master
+DTSTART;TZID=America/Los_Angeles:20101007T113000
+CREATED:20100820T235846Z
+ORGANIZER;CN="The Organizer":mailto:organizer at example.com
+ATTENDEE;CN="Attendee 1";CUTYPE=INDIVIDUAL;EMAIL="attendee1 at example.com";
+ PARTSTAT=NEEDS-ACTION;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:attendee1 at ex
+ ample.com
+ATTENDEE;CN="Attendee 2";CUTYPE=INDIVIDUAL;EMAIL="attendee2 at example.com";
+ PARTSTAT=NEEDS-ACTION;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:attendee2 at ex
+ ample.com
+ATTENDEE;CN="Missing Attendee";CUTYPE=INDIVIDUAL;EMAIL="missing at example.com";
+ PARTSTAT=NEEDS-ACTION;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:missing at ex
+ ample.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ filtered = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:REPLY
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:04405DDD-C938-46FC-A4CE-8573613BEA39
+RECURRENCE-ID;TZID=America/Los_Angeles:20100826T130000
+DTSTART;TZID=America/Los_Angeles:20101007T113000
+DTEND;TZID=America/Los_Angeles:20101007T120000
+ATTENDEE;CN=Missing Attendee;CUTYPE=INDIVIDUAL;EMAIL=missing at example.com;P
+ ARTSTAT=DECLINED;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:missing at example.com
+ORGANIZER;CN=The Organizer:mailto:organizer at example.com
+REQUEST-STATUS:2.0;Success
+SEQUENCE:24
+SUMMARY:Missing attendee in master
+END:VEVENT
+END:VCALENDAR
+"""
+ component = Component.fromString(original)
+ itipped = iTipGenerator.generateAttendeeReply(component, "mailto:missing at example.com", force_decline=True)
+ itipped = str(itipped).replace("\r", "")
+ itipped = "".join([line for line in itipped.splitlines(True) if not line.startswith("DTSTAMP:")])
+ self.assertEqual(filtered, itipped)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120216/c273bfa9/attachment-0001.html>
More information about the calendarserver-changes
mailing list