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

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 26 09:18:16 PDT 2007


Revision: 1425
          http://trac.macosforge.org/projects/calendarserver/changeset/1425
Author:   cdaboo at apple.com
Date:     2007-03-26 09:18:16 -0700 (Mon, 26 Mar 2007)

Log Message:
-----------
Fix problem where dropbox and notification live properties were not being registered when enabled via config.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2007-03-26 15:33:13 UTC (rev 1424)
+++ CalendarServer/trunk/twistedcaldav/config.py	2007-03-26 16:18:16 UTC (rev 1425)
@@ -195,6 +195,21 @@
             if param not in serviceDefaultParams[self._data["DirectoryService"]["type"]]:
                 del self._data["DirectoryService"]["params"][param]
 
+        self.updateServerCapabilities()
+
+    def updateServerCapabilities(self):
+        """
+        Change server capabilities based on the current config parameters.
+        Here are the "features" in the config that need special treatment:
+        
+        EnableDropBox
+        EnableNotifications
+        """
+        
+        from twistedcaldav.resource import CalendarPrincipalResource
+        CalendarPrincipalResource.enableDropBox(self.EnableDropBox)
+        CalendarPrincipalResource.enableNotifications(self.EnableNotifications)
+
     def updateDefaults(self, items):
         _mergeData(self._defaults, items)
         self.update(items)

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2007-03-26 15:33:13 UTC (rev 1424)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2007-03-26 16:18:16 UTC (rev 1425)
@@ -574,11 +574,21 @@
         (caldav_namespace, "schedule-outbox-URL"      ),
     )
 
-    if config.EnableDropBox:
-        liveProperties += ((calendarserver_namespace, "dropbox-home-URL" ),)
+    @classmethod
+    def enableDropBox(clz, enable):
+        qname = (calendarserver_namespace, "dropbox-home-URL" )
+        if enable and qname not in clz.liveProperties:
+            clz.liveProperties += (qname,)
+        elif not enable and qname in clz.liveProperties:
+            clz.liveProperties = tuple([p for p in clz.liveProperties if p != qname])
 
-    if config.EnableNotifications:
-        liveProperties += ((calendarserver_namespace, "notifications-URL"),)
+    @classmethod
+    def enableNotifications(clz, enable):
+        qname = (calendarserver_namespace, "notifications-URL" )
+        if enable and qname not in clz.liveProperties:
+            clz.liveProperties += (qname,)
+        elif not enable and qname in clz.liveProperties:
+            clz.liveProperties = tuple([p for p in clz.liveProperties if p != qname])
 
     def isCollection(self):
         return True

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070326/0240d958/attachment.html


More information about the calendarserver-changes mailing list