[CalendarServer-changes] [12826] twext/trunk/twext/who/aggregate.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 5 18:53:39 PST 2014


Revision: 12826
          http://trac.calendarserver.org//changeset/12826
Author:   sagen at apple.com
Date:     2014-03-05 18:53:39 -0800 (Wed, 05 Mar 2014)
Log Message:
-----------
For recordWithShortName, go straight to the service handling the given recordType

Modified Paths:
--------------
    twext/trunk/twext/who/aggregate.py

Modified: twext/trunk/twext/who/aggregate.py
===================================================================
--- twext/trunk/twext/who/aggregate.py	2014-03-06 01:35:57 UTC (rev 12825)
+++ twext/trunk/twext/who/aggregate.py	2014-03-06 02:53:39 UTC (rev 12826)
@@ -25,7 +25,7 @@
 
 from itertools import chain
 
-from twisted.internet.defer import gatherResults, FirstError
+from twisted.internet.defer import gatherResults, FirstError, succeed
 
 from .idirectory import DirectoryConfigurationError, IDirectoryService
 from .directory import (
@@ -91,3 +91,14 @@
         d.addCallback(lambda results: chain(*results))
         d.addErrback(unwrapFirstError)
         return d
+
+
+    def recordWithShortName(self, recordType, shortName):
+        """
+        Since we know the recordType, we can go directly to the appropriate
+        service.
+        """
+        for service in self.services:
+            if recordType in service.recordType.iterconstants():
+                return service.recordWithShortName(recordType, shortName)
+        return succeed(None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140305/1846e51d/attachment-0001.html>


More information about the calendarserver-changes mailing list