[CalendarServer-changes] [6930] CalendarServer/trunk/twistedcaldav/directory

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 15 11:50:17 PST 2011


Revision: 6930
          http://trac.macosforge.org/projects/calendarserver/changeset/6930
Author:   sagen at apple.com
Date:     2011-02-15 11:50:17 -0800 (Tue, 15 Feb 2011)
Log Message:
-----------
Removing the principal resource cache since it's storing principals potentially based on incomplete, transient records generated from a principal-property-search report.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2011-02-15 17:18:41 UTC (rev 6929)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2011-02-15 19:50:17 UTC (rev 6930)
@@ -35,8 +35,6 @@
 from urllib import unquote
 from urlparse import urlparse
 
-from weakref import WeakValueDictionary
-
 from twisted.cred.credentials import UsernamePassword
 from twisted.python.failure import Failure
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -437,7 +435,6 @@
         )
 
         self.parent = parent
-        self._principalResourceCache = WeakValueDictionary()
 
     def principalForUID(self, uid):
         return self.parent.principalForUID(uid)
@@ -449,15 +446,12 @@
         if record is None:
             return None
 
-        if record in self._principalResourceCache:
-            return self._principalResourceCache[record]
         if record.enabledForCalendaring or record.enabledForAddressBooks:
             # XXX these are different features and one should not automatically
             # imply the other...
             principal = DirectoryCalendarPrincipalResource(self, record)
         else:
             principal = DirectoryPrincipalResource(self, record)
-        self._principalResourceCache[record] = principal
         return principal
 
     ##

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2011-02-15 17:18:41 UTC (rev 6929)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2011-02-15 19:50:17 UTC (rev 6930)
@@ -177,19 +177,6 @@
             self.failIf(principal is None)
             self.assertEquals(record, principal.record)
 
-
-    def test_principalForUIDCache(self):
-        """
-        L{DirectoryPrincipalUIDProvisioningResource.principalForUID} should
-        return an identical principal resource when passed the same principal.
-        """
-        for provisioningResource, recordType, recordResource, record in self._allRecords():
-            principal = provisioningResource.principalForRecord(record)
-            principal2 = provisioningResource.principalForRecord(record)
-            self.assertIdentical(principal, principal2,
-                                 ("mismatch from %s" % (provisioningResource,)))
-
-
     def test_principalForRecord(self):
         """
         DirectoryPrincipalProvisioningResource.principalForRecord()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110215/07c5c912/attachment.html>


More information about the calendarserver-changes mailing list