[CalendarServer-changes] [1782] CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 10 12:27:35 PDT 2007


Revision: 1782
          http://trac.macosforge.org/projects/calendarserver/changeset/1782
Author:   cdaboo at apple.com
Date:     2007-08-10 12:27:34 -0700 (Fri, 10 Aug 2007)

Log Message:
-----------
Fix odds and ends in cached guid implementation. Now passes all tests/CalDAVTester.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py

Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2007-08-10 17:10:06 UTC (rev 1781)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2007-08-10 19:27:34 UTC (rev 1782)
@@ -358,6 +358,7 @@
             storage = self._records[recordType]
         except KeyError:
             self.reloadCache(recordType)
+            storage = self._records[recordType]
         else:
             if storage["status"] == "stale":
                 storage["status"] = "loading"
@@ -379,7 +380,7 @@
         type.  Keys are short names and values are the cooresponding
         OpenDirectoryRecord for the given record type.
         """
-        self._storage(recordType)["records"]
+        return self._storage(recordType)["records"]
 
     def listRecords(self, recordType):
         return self.recordsForType(recordType).itervalues()
@@ -396,7 +397,11 @@
     def recordWithGUID(self, guid):
         # Override super's implementation with something faster.
         for recordType in self.recordTypes():
-            return self._storage(recordType)["guids"].get(guid, None)
+            record = self._storage(recordType)["guids"].get(guid, None)
+            if record:
+                return record
+        else:
+            return None
 
     def reloadCache(self, recordType, shortName=None):
         log.msg("Reloading %s record cache" % (recordType,))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070810/76adadbe/attachment.html


More information about the calendarserver-changes mailing list