[CalendarServer-changes] [12976] twext/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 19 17:09:13 PDT 2014
Revision: 12976
http://trac.calendarserver.org//changeset/12976
Author: wsanchez at apple.com
Date: 2014-03-19 17:09:13 -0700 (Wed, 19 Mar 2014)
Log Message:
-----------
Get rid of listRecords(); we already have recordsWithRecordType().
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-20 00:08:06 UTC (rev 12975)
+++ twext/trunk/twext/who/aggregate.py 2014-03-20 00:09:13 UTC (rev 12976)
@@ -94,22 +94,18 @@
def recordWithShortName(self, recordType, shortName):
- """
- Since we know the recordType, we can go directly to the appropriate
- service.
- """
+ # 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.recordWithShortName(recordType, shortName)
return succeed(None)
- def listRecords(self, recordType):
- """
- Since we know the recordType, we can go directly to the appropriate
- service.
- """
+ def recordsWithRecordType(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([])
+ return service.recordsWithRecordType(recordType)
+ return succeed(())
Modified: twext/trunk/twext/who/index.py
===================================================================
--- twext/trunk/twext/who/index.py 2014-03-20 00:08:06 UTC (rev 12975)
+++ twext/trunk/twext/who/index.py 2014-03-20 00:09:13 UTC (rev 12976)
@@ -28,7 +28,7 @@
from twisted.internet.defer import succeed, inlineCallbacks, returnValue
from .util import ConstantsContainer, uniqueResult
-from .idirectory import FieldName as BaseFieldName, DirectoryServiceError
+from .idirectory import FieldName as BaseFieldName
from .expression import MatchExpression, MatchType, MatchFlags
from .directory import (
DirectoryService as BaseDirectoryService,
@@ -363,22 +363,7 @@
)
- def listRecords(self, recordType):
- recordTypeIndexes = self.index[self.fieldName.recordType]
- try:
- records = recordTypeIndexes[recordType]
- except KeyError:
- raise DirectoryServiceError(
- "Record type {} is not one of the indexed record types "
- "for service {}: {}"
- .format(recordType, self, recordTypeIndexes.keys())
- )
-
- return succeed(records)
-
-
-
class DirectoryRecord(BaseDirectoryRecord):
"""
Indexed directory record.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140319/19553d8d/attachment-0001.html>
More information about the calendarserver-changes
mailing list