[CalendarServer-changes] [2018] CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 15 11:54:29 PST 2007


Revision: 2018
          http://trac.macosforge.org/projects/calendarserver/changeset/2018
Author:   wsanchez at apple.com
Date:     2007-11-15 11:54:28 -0800 (Thu, 15 Nov 2007)

Log Message:
-----------
Pulled up r2009 from trunk.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/ical.py
    CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/test/test_icalendar.py

Modified: CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/ical.py	2007-11-15 19:48:52 UTC (rev 2017)
+++ CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/ical.py	2007-11-15 19:54:28 UTC (rev 2018)
@@ -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/branches/release/CalendarServer-1.1-dev/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/test/test_icalendar.py	2007-11-15 19:48:52 UTC (rev 2017)
+++ CalendarServer/branches/release/CalendarServer-1.1-dev/twistedcaldav/test/test_icalendar.py	2007-11-15 19:54:28 UTC (rev 2018)
@@ -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/20071115/15d5c210/attachment-0001.html


More information about the calendarserver-changes mailing list