[CalendarServer-changes] [2009] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 14 14:22:24 PST 2007
Revision: 2009
http://trac.macosforge.org/projects/calendarserver/changeset/2009
Author: cdaboo at apple.com
Date: 2007-11-14 14:22:23 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Make sure empty list is returned when no matching attendees are found.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2007-11-14 21:35:38 UTC (rev 2008)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2007-11-14 22:22:23 UTC (rev 2009)
@@ -1010,7 +1010,7 @@
# Need to normalize http/https cu addresses
test = set()
for item in match:
- test.add(_normalizeCUAddress(item))
+ test.add(_normalizeCUAddress(item))
# Extract appropriate sub-component if this is a VCALENDAR
if self.name() == "VCALENDAR":
@@ -1035,24 +1035,13 @@
assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
- # FIXME: we should really have a URL class and have it manage comparisons
- # in a sensible fashion.
- def _normalizeCUAddress(addr):
- if addr.startswith("/") or addr.startswith("http:") or addr.startswith("https:"):
- return addr.rstrip("/")
- else:
- return addr
-
- # Need to normalize http/https cu addresses
- test = set()
- for item in match:
- test.add(_normalizeCUAddress(item))
-
# Extract appropriate sub-component if this is a VCALENDAR
results = []
for component in self.subcomponents():
if component.name() != "VTIMEZONE":
- results.append(component.getAttendeeProperty(match))
+ attendee = component.getAttendeeProperty(match)
+ if attendee:
+ results.append(attendee)
return results
Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py 2007-11-14 21:35:38 UTC (rev 2008)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py 2007-11-14 22:22:23 UTC (rev 2009)
@@ -208,3 +208,35 @@
self.assertEqual(parse_duration("-P15DT5H0M20S"), datetime.timedelta(days=-15, hours=-5, minutes=0, seconds=-20))
self.assertEqual(parse_duration("P7W"), datetime.timedelta(weeks=7))
+
+ def test_correct_attendee_properties(self):
+
+ data = """BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ component = Component.fromString(data)
+ self.assertEqual([p.value() for p in component.getAttendeeProperties(("mailto:user2 at example.com",))], ["mailto:user2 at example.com",])
+
+ def test_empty_attendee_properties(self):
+
+ data = """BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ component = Component.fromString(data)
+ self.assertEqual(component.getAttendeeProperties(("user3 at example.com",)), [])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071114/40e4be29/attachment.html
More information about the calendarserver-changes
mailing list