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

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 22 11:31:18 PDT 2011


Revision: 8113
          http://trac.macosforge.org/projects/calendarserver/changeset/8113
Author:   sagen at apple.com
Date:     2011-09-22 11:31:17 -0700 (Thu, 22 Sep 2011)
Log Message:
-----------
Adds configurable <env> to push-transports property (10151541)

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/customxml.py
    CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py
    CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/twistedcaldav/test/test_notify.py

Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/customxml.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -319,6 +319,7 @@
     allowed_children = {
         (calendarserver_namespace, "subscription-url") : (1, 1),
         (calendarserver_namespace, "apsbundleid") : (1, 1),
+        (calendarserver_namespace, "env") : (1, 1),
         (calendarserver_namespace, "xmpp-server") : (1, 1),
         (calendarserver_namespace, "xmpp-uri") : (1, 1),
     }
@@ -336,6 +337,12 @@
     protected = True
     hidden = True
 
+class PubSubAPSEnvironmentProperty (davxml.WebDAVTextElement):
+    namespace = calendarserver_namespace
+    name = "env"
+    protected = True
+    hidden = True
+
 class PubSubXMPPPushKeyProperty (davxml.WebDAVTextElement):
     namespace = calendarserver_namespace
     name = "pushkey"

Modified: CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -60,7 +60,8 @@
         
 class DictRecordTypeCache(RecordTypeCache, LoggingMixIn):
     """
-    Cache implementation using a dict. Does not share the cache with other instances.
+    Cache implementation using a dict, and uses memcached to share records
+    with other instances.
     """
     
     def __init__(self, directoryService, recordType):
@@ -108,6 +109,7 @@
     def removeRecord(self, record):
         if record in self.records:
             self.records.remove(record)
+            self.log_debug("Removed record %s" % (record.guid,))
             for indexType in self.directoryService.indexTypes():
                 try:
                     indexData = getattr(record, CachingDirectoryService.indexTypeToRecordAttribute[indexType])
@@ -119,7 +121,7 @@
                     try:
                         del self.recordsIndexedBy[indexType][item]
                     except KeyError:
-                        self.log_debug("Missing record index item; type: %s, item: %s" % (indexType, item))
+                        pass
         
     def findRecord(self, indexType, indexKey):
         self.purgeExpiredRecords()

Modified: CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -815,10 +815,6 @@
                     record = self._ldapResultToRecord(dn, attrs, recordType)
                     self.log_debug("Got LDAP record %s" % (record,))
 
-                    self.recordCacheForType(recordType).addRecord(record,
-                        indexType, indexKey
-                    )
-
                     if not unrestricted:
                         self.log_debug("%s is not enabled because it's not a member of group: %s" % (guid, self.restrictToGroup))
                         record.enabledForCalendaring = False
@@ -826,6 +822,10 @@
 
                     record.applySACLs()
 
+                    self.recordCacheForType(recordType).addRecord(record,
+                        indexType, indexKey
+                    )
+
                     # We got a match, so don't bother checking other types
                     break
 

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -2243,6 +2243,9 @@
                                     customxml.PubSubAPSBundleIDProperty(
                                         apsConfiguration["APSBundleID"]
                                     ),
+                                    customxml.PubSubAPSEnvironmentProperty(
+                                        apsConfiguration["APSEnvironment"]
+                                    ),
                                     type="APSD",
                                 )
                             )

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -640,10 +640,12 @@
                 "CalDAV" : {
                     "APSBundleID" : "",
                     "SubscriptionURL" : "",
+                    "APSEnvironment" : "PRODUCTION",
                 },
                 "CardDAV" : {
                     "APSBundleID" : "",
                     "SubscriptionURL" : "",
+                    "APSEnvironment" : "PRODUCTION",
                 },
                 "NodeConfiguration" : {
                     "pubsub#deliver_payloads" : "1",

Modified: CalendarServer/trunk/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_notify.py	2011-09-22 02:26:28 UTC (rev 8112)
+++ CalendarServer/trunk/twistedcaldav/test/test_notify.py	2011-09-22 18:31:17 UTC (rev 8113)
@@ -601,7 +601,7 @@
         conf = getPubSubConfiguration(enabledConfig)
         self.assertEquals(conf, {'heartrate': 30, 'service': 'pubsub.example.com', 'xmpp-server': 'example.com', 'enabled': True, 'host': '', 'port': 0} )
         conf = getPubSubAPSConfiguration("CalDAV|foo", enabledConfig)
-        self.assertEquals(conf, {'SubscriptionURL': 'CalDAVSubscriptionURL', 'APSBundleID': 'CalDAVAPSBundleID'} )
+        self.assertEquals(conf, {'SubscriptionURL': 'CalDAVSubscriptionURL', 'APSBundleID': 'CalDAVAPSBundleID', 'APSEnvironment' : 'PRODUCTION'} )
         conf = getPubSubAPSConfiguration("noprefix", enabledConfig)
         self.assertEquals(conf, None)
         conf = getPubSubAPSConfiguration("UnknownPrefix|foo", enabledConfig)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110922/a4ce82c0/attachment.html>


More information about the calendarserver-changes mailing list