[CalendarServer-changes] [13013] twext/trunk/twext/who/index.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 27 17:28:36 PDT 2014
Revision: 13013
http://trac.calendarserver.org//changeset/13013
Author: wsanchez at apple.com
Date: 2014-03-27 17:28:36 -0700 (Thu, 27 Mar 2014)
Log Message:
-----------
Use expression.match.
Modified Paths:
--------------
twext/trunk/twext/who/index.py
Modified: twext/trunk/twext/who/index.py
===================================================================
--- twext/trunk/twext/who/index.py 2014-03-28 00:26:55 UTC (rev 13012)
+++ twext/trunk/twext/who/index.py 2014-03-28 00:28:36 UTC (rev 13013)
@@ -303,25 +303,6 @@
@return: The matching records.
@rtype: deferred iterable of L{DirectoryRecord}s
"""
- predicate = MatchFlags.predicator(expression.flags)
- normalize = MatchFlags.normalizer(expression.flags)
-
- matchValue = normalize(expression.fieldValue)
- matchType = expression.matchType
-
- if matchType == MatchType.startsWith:
- match = lambda fieldValue: predicate(
- fieldValue.startswith(matchValue)
- )
- elif matchType == MatchType.contains:
- match = lambda fieldValue: predicate(matchValue in fieldValue)
- elif matchType == MatchType.equals:
- match = lambda fieldValue: predicate(fieldValue == matchValue)
- else:
- raise NotImplementedError(
- "Unknown match type: {0!r}".format(matchType)
- )
-
result = set()
if records is None:
@@ -337,7 +318,7 @@
continue
for fieldValue in fieldValues:
- if match(normalize(fieldValue)):
+ if expression.match(fieldValue):
result.add(record)
return succeed(result)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140327/c4a6b3fb/attachment-0001.html>
More information about the calendarserver-changes
mailing list