[CalendarServer-changes] [3328] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 6 11:09:56 PST 2008


Revision: 3328
          http://trac.macosforge.org/projects/calendarserver/changeset/3328
Author:   sagen at apple.com
Date:     2008-11-06 11:09:55 -0800 (Thu, 06 Nov 2008)
Log Message:
-----------
Changing notification config to use a dict of services rather than an array to play nice with merging of default values

Modified Paths:
--------------
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/notify.py
    CalendarServer/trunk/twistedcaldav/test/test_notify.py

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2008-11-06 03:32:34 UTC (rev 3327)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2008-11-06 19:09:55 UTC (rev 3328)
@@ -403,7 +403,8 @@
       <integer>62309</integer>
 
       <key>Services</key>
-      <array>
+      <dict>
+        <key>SimpleLineNotifier</key>
         <dict>
           <!-- Simple line notification service (for testing) -->
           <key>Service</key>
@@ -414,6 +415,7 @@
           <integer>62308</integer>
         </dict>
 
+        <key>XMPPNotifier</key>
         <dict>
           <!-- XMPP notification service -->
           <key>Service</key>
@@ -461,7 +463,7 @@
              -->
           </array>
         </dict>
-      </array>
+      </dict>
     </dict>
 
 

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2008-11-06 03:32:34 UTC (rev 3327)
+++ CalendarServer/trunk/conf/caldavd.plist	2008-11-06 19:09:55 UTC (rev 3328)
@@ -295,7 +295,8 @@
       <integer>10</integer>
 
       <key>Services</key>
-      <array>
+      <dict>
+        <key>XMPPNotifier</key>
         <dict>
           <!-- XMPP notification service -->
           <key>Service</key>
@@ -335,7 +336,7 @@
           <key>HeartbeatMinutes</key>
           <integer>30</integer>
         </dict>
-      </array>
+      </dict>
     </dict>
 
 

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-11-06 03:32:34 UTC (rev 3327)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-11-06 19:09:55 UTC (rev 3328)
@@ -255,13 +255,13 @@
         "InternalNotificationHost" : "localhost",
         "InternalNotificationPort" : 62309,
 
-        "Services" : [
-            {
+        "Services" : {
+            "SimpleLineNotifier" : {
                 "Service" : "twistedcaldav.notify.SimpleLineNotifierService",
                 "Enabled" : False,
                 "Port" : 62308,
             },
-            {
+            "XMPPNotifier" : {
                 "Service" : "twistedcaldav.notify.XMPPNotifierService",
                 "Enabled" : False,
                 "Host" : "", # "xmpp.host.name"
@@ -277,7 +277,7 @@
                 "HeartbeatMinutes" : 30,
                 "AllowedJIDs": [],
             },
-        ]
+        }
     },
 
     #
@@ -572,14 +572,14 @@
         #
         # Notifications
         #
-        for service in self.Notifications["Services"]:
+        for key, service in self.Notifications["Services"].iteritems():
             if service["Enabled"]:
                 self.Notifications["Enabled"] = True
                 break
         else:
             self.Notifications["Enabled"] = False
 
-        for service in self.Notifications["Services"]:
+        for key, service in self.Notifications["Services"].iteritems():
             if (
                 service["Service"] == "twistedcaldav.notify.XMPPNotifierService" and
                 service["Enabled"]

Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py	2008-11-06 03:32:34 UTC (rev 3327)
+++ CalendarServer/trunk/twistedcaldav/notify.py	2008-11-06 19:09:55 UTC (rev 3328)
@@ -1151,7 +1151,7 @@
     results = { 'enabled' : False }
 
     # return the first enabled xmpp service settings in the config file
-    for settings in config.Notifications["Services"]:
+    for key, settings in config.Notifications["Services"].iteritems():
         if (settings["Service"] == "twistedcaldav.notify.XMPPNotifierService"
             and settings["Enabled"]):
             results['enabled'] = True
@@ -1291,7 +1291,7 @@
         multiService = service.MultiService()
 
         notifiers = []
-        for settings in config.Notifications["Services"]:
+        for key, settings in config.Notifications["Services"].iteritems():
             if settings["Enabled"]:
                 notifier = namedClass(settings["Service"])(settings)
                 notifier.setServiceParent(multiService)

Modified: CalendarServer/trunk/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_notify.py	2008-11-06 03:32:34 UTC (rev 3327)
+++ CalendarServer/trunk/twistedcaldav/test/test_notify.py	2008-11-06 19:09:55 UTC (rev 3328)
@@ -338,12 +338,12 @@
 class XMPPNotifierTests(TestCase):
 
     xmppEnabledConfig = Config(config_mod.defaultConfig)
-    xmppEnabledConfig.Notifications['Services'][1]['Enabled'] = True
+    xmppEnabledConfig.Notifications['Services']['XMPPNotifier']['Enabled'] = True
     xmppEnabledConfig.ServerHostName = "server.example.com"
     xmppEnabledConfig.HTTPPort = 80
 
     xmppDisabledConfig = Config(config_mod.defaultConfig)
-    xmppDisabledConfig.Notifications['Services'][1]['Enabled'] = False
+    xmppDisabledConfig.Notifications['Services']['XMPPNotifier']['Enabled'] = False
 
     def setUp(self):
         self.xmlStream = StubXmlStream()
@@ -473,7 +473,7 @@
     def test_sendHeartbeat(self):
 
         xmppConfig = Config(config_mod.defaultConfig)
-        xmppConfig.Notifications['Services'][1]['Enabled'] = True
+        xmppConfig.Notifications['Services']['XMPPNotifier']['Enabled'] = True
         xmppConfig.ServerHostName = "server.example.com"
         xmppConfig.HTTPPort = 80
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081106/2b3436a5/attachment.html>


More information about the calendarserver-changes mailing list