[CalendarServer-changes] [2759] CalendarServer/trunk/twistedcaldav/notify.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 23 15:43:59 PDT 2008


Revision: 2759
          http://trac.macosforge.org/projects/calendarserver/changeset/2759
Author:   wsanchez at apple.com
Date:     2008-07-23 15:43:59 -0700 (Wed, 23 Jul 2008)
Log Message:
-----------
Do not send configuration fields that we aren't configuring.
Always send the FORM_TYPE field.

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

Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py	2008-07-23 20:11:07 UTC (rev 2758)
+++ CalendarServer/trunk/twistedcaldav/notify.py	2008-07-23 22:43:59 UTC (rev 2759)
@@ -467,8 +467,8 @@
     pubsubNS = 'http://jabber.org/protocol/pubsub'
 
     nodeConf = {
-        'pubsub#deliver_payloads' : '0',
-        'pubsub#persist_items' : '0',
+        'pubsub#deliver_payloads': '0',
+        'pubsub#persist_items'   : '0',
     }
 
     def __init__(self, settings, reactor=None, configOverride=None):
@@ -577,15 +577,22 @@
 
                         for field in formElement.elements():
                             if field.name == 'field':
-                                value = self.nodeConf.get(field['var'], None)
-                                if value is not None:
-                                    valueElement = self._getChild(field,
-                                        'value')
-                                    valueElement.children = []
-                                    valueElement.addContent(value)
-                            filledForm.addChild(field)
+                                var = field['var']
+                                if var == "FORM_TYPE":
+                                    filledForm.addChild(field)
+                                else:
+                                    value = self.nodeConf.get(var, None)
+                                    if value is not None:
+                                        filledField = filledForm.addElement('field')
+                                        filledField['var'] = var
+                                        filledField['type'] = field['type']
+                                        valueElement = filledField.addElement('value')
+                                        valueElement.addContent(value)
+                                        filledForm.addChild(field)
                         filledIq.addCallback(self.responseFromConfiguration,
                             nodeName)
+                        self.sendDebug("Sending configuration form (%s)"
+                                       % (nodeName,), filledIq)
                         filledIq.send(to=self.settings['ServiceAddress'])
         else:
             self.log_error("PubSub configuration form request error: %s" %
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080723/c3afb4a5/attachment.html 


More information about the calendarserver-changes mailing list