[CalendarServer-changes] [14015] CalendarServer/trunk/twistedcaldav/storebridge.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 25 13:54:32 PDT 2014


Revision: 14015
          http://trac.calendarserver.org//changeset/14015
Author:   sagen at apple.com
Date:     2014-09-25 13:54:32 -0700 (Thu, 25 Sep 2014)
Log Message:
-----------
Handle old notification format

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/storebridge.py

Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py	2014-09-25 20:32:56 UTC (rev 14014)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py	2014-09-25 20:54:32 UTC (rev 14015)
@@ -3914,6 +3914,14 @@
 
         if qname == customxml.NotificationType.qname():
             jsontype = self._newStoreObject.notificationType()
+
+            # FIXME: notificationType( ) does not always return json; it can
+            # currently return a utf-8 encoded str of XML
+            if isinstance(jsontype, str):
+                returnValue(
+                    davxml.WebDAVDocument.fromString(jsontype).root_element
+                )
+
             if jsontype["notification-type"] == "invite-notification":
                 typeAttr = {"shared-type": jsontype["shared-type"]}
                 xmltype = customxml.InviteNotification(**typeAttr)
@@ -3938,6 +3946,12 @@
     def text(self, ignored=None):
         assert ignored is None, "This is a notification object, not a notification"
         jsondata = (yield self._newStoreObject.notificationData())
+
+        # FIXME: notificationData( ) does not always return json; it can
+        # currently return a utf-8 encoded str of XML
+        if isinstance(jsondata, str):
+            returnValue(jsondata)
+
         if jsondata["notification-type"] == "invite-notification":
             ownerPrincipal = yield self.principalForUID(jsondata["owner"])
             ownerCN = ownerPrincipal.displayName()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140925/9bf7fa32/attachment.html>


More information about the calendarserver-changes mailing list