[CalendarServer-changes] [12891] twext/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 17:51:31 PDT 2014


Revision: 12891
          http://trac.calendarserver.org//changeset/12891
Author:   sagen at apple.com
Date:     2014-03-12 17:51:31 -0700 (Wed, 12 Mar 2014)
Log Message:
-----------
Implement listRecords for aggregate and index directory services

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

Modified: twext/trunk/twext/who/aggregate.py
===================================================================
--- twext/trunk/twext/who/aggregate.py	2014-03-13 00:50:55 UTC (rev 12890)
+++ twext/trunk/twext/who/aggregate.py	2014-03-13 00:51:31 UTC (rev 12891)
@@ -102,3 +102,14 @@
             if recordType in service.recordTypes():
                 return service.recordWithShortName(recordType, shortName)
         return succeed(None)
+
+
+    def listRecords(self, recordType):
+        """
+        Since we know the recordType, we can go directly to the appropriate
+        service.
+        """
+        for service in self.services:
+            if recordType in service.recordTypes():
+                return service.listRecords(recordType)
+        return succeed([])

Modified: twext/trunk/twext/who/index.py
===================================================================
--- twext/trunk/twext/who/index.py	2014-03-13 00:50:55 UTC (rev 12890)
+++ twext/trunk/twext/who/index.py	2014-03-13 00:51:31 UTC (rev 12891)
@@ -363,7 +363,14 @@
             )
 
 
+    def listRecords(self, recordType):
+        records = []
+        for record in self.index[self.fieldName.recordType][recordType]:
+            records.append(record)
+        return succeed(records)
 
+
+
 class DirectoryRecord(BaseDirectoryRecord):
     """
     XML directory record
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/29f0b7a9/attachment.html>


More information about the calendarserver-changes mailing list