[CalendarServer-changes] [9117] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 16 10:17:50 PDT 2012


Revision: 9117
          http://trac.macosforge.org/projects/calendarserver/changeset/9117
Author:   sagen at apple.com
Date:     2012-04-16 10:17:49 -0700 (Mon, 16 Apr 2012)
Log Message:
-----------
Base64-encode CALENDARSERVER-OLD-CUA parameter value

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	2012-04-14 01:43:15 UTC (rev 9116)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2012-04-16 17:17:49 UTC (rev 9117)
@@ -56,6 +56,8 @@
 from pycalendar.timezone import PyCalendarTimezone
 from pycalendar.utcoffsetvalue import PyCalendarUTCOffsetValue
 
+import base64
+
 log = Logger()
 
 iCalendarProductID = "-//CALENDARSERVER.ORG//NONSGML Version 1//EN"
@@ -2577,7 +2579,7 @@
                     if config.Scheduling.Options.V1Compatibility:
                         if cuaddr.startswith("http") or cuaddr.startswith("/"):
                             prop.setParameter("CALENDARSERVER-OLD-CUA",
-                                prop.value())
+                                "base64-%s" % (base64.b64encode(prop.value())))
 
                     # Always re-write value to urn:uuid
                     prop.setValue("urn:uuid:%s" % (guid,))
@@ -2588,6 +2590,8 @@
                     # Restore old CUA
                     oldExternalCUA = prop.parameterValue("CALENDARSERVER-OLD-CUA")
                     if oldExternalCUA:
+                        if oldExternalCUA.startswith("base64-"):
+                            oldExternalCUA = base64.b64decode(oldExternalCUA[7:])
                         newaddr = oldExternalCUA
                         prop.removeParameter("CALENDARSERVER-OLD-CUA")
                     elif oldemail:

Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2012-04-14 01:43:15 UTC (rev 9116)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2012-04-16 17:17:49 UTC (rev 9117)
@@ -5993,7 +5993,7 @@
 ATTENDEE:urn:uuid:foo
 ATTENDEE:urn:uuid:bar
 ATTENDEE:urn:uuid:baz
-ATTENDEE;CALENDARSERVER-OLD-CUA="http://example.com/principals/users/buz":urn:uuid:buz
+ATTENDEE;CALENDARSERVER-OLD-CUA="base64-aHR0cDovL2V4YW1wbGUuY29tL3ByaW5jaXBhbHMvdXNlcnMvYnV6":urn:uuid:buz
 DTSTAMP:20071114T000000Z
 END:VEVENT
 END:VCALENDAR
@@ -6075,17 +6075,17 @@
         self.patch(config.Scheduling.Options, "V1Compatibility", True)
         component.normalizeCalendarUserAddresses(lookupFunction, None, toUUID=True)
 
-        # /principal CUAs are not stored in CALENDARSERVER-OLD-CUA
+        # /principal CUAs are stored in CALENDARSERVER-OLD-CUA
         prop = component.getAttendeeProperty(("urn:uuid:foo",))
         self.assertEquals("urn:uuid:foo", prop.value())
         self.assertEquals(prop.parameterValue("CALENDARSERVER-OLD-CUA"),
-            "/principals/users/foo")
+            "base64-L3ByaW5jaXBhbHMvdXNlcnMvZm9v")
 
         # http CUAs are stored in CALENDARSERVER-OLD-CUA
         prop = component.getAttendeeProperty(("urn:uuid:buz",))
         self.assertEquals("urn:uuid:buz", prop.value())
         self.assertEquals(prop.parameterValue("CALENDARSERVER-OLD-CUA"),
-            "http://example.com/principals/users/buz")
+            "base64-aHR0cDovL2V4YW1wbGUuY29tL3ByaW5jaXBhbHMvdXNlcnMvYnV6")
 
 
     def test_serializationCaching(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120416/e1853cb2/attachment.html>


More information about the calendarserver-changes mailing list