[CalendarServer-changes] [9555] CalendarServer/trunk/calendarserver/tools/shell/directory.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 10 15:35:39 PDT 2012


Revision: 9555
          http://trac.macosforge.org/projects/calendarserver/changeset/9555
Author:   wsanchez at apple.com
Date:     2012-08-10 15:35:38 -0700 (Fri, 10 Aug 2012)
Log Message:
-----------
Use directory.recordsMatchingTokens() to find records via search terms

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/shell/directory.py

Modified: CalendarServer/trunk/calendarserver/tools/shell/directory.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/directory.py	2012-08-10 21:31:06 UTC (rev 9554)
+++ CalendarServer/trunk/calendarserver/tools/shell/directory.py	2012-08-10 22:35:38 UTC (rev 9555)
@@ -37,18 +37,10 @@
 
 @inlineCallbacks
 def findRecords(directory, terms):
-    for term in terms:
-        searchFieldNames = ("fullName", "firstName", "lastName", "emailAddresses")
-        searchFields = tuple(
-            (fieldName, term, True, "contains")
-            for fieldName in searchFieldNames
-        )
+    records = tuple((yield directory.recordsMatchingTokens(terms)))
+    returnValue(sorted(records, key=operator.attrgetter("fullName")))
 
-    records = (yield directory.recordsMatchingFields(searchFields))
 
-    returnValue(sorted(tuple(records), key=operator.attrgetter("fullName")))
-
-
 @inlineCallbacks
 def recordInfo(directory, record):
     """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120810/ee38fc3f/attachment.html>


More information about the calendarserver-changes mailing list