[CalendarServer-changes] [10731] CalendarServer/trunk/twext/who/xml.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 14 11:03:54 PST 2013


Revision: 10731
          http://trac.calendarserver.org//changeset/10731
Author:   wsanchez at apple.com
Date:     2013-02-14 11:03:54 -0800 (Thu, 14 Feb 2013)
Log Message:
-----------
Handle MatchType.contains and MatchType.startsWith

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/xml.py

Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py	2013-02-14 18:53:12 UTC (rev 10730)
+++ CalendarServer/trunk/twext/who/xml.py	2013-02-14 19:03:54 UTC (rev 10731)
@@ -359,14 +359,15 @@
         @type expression: L{object}
         """
         fieldIndex = self.index[expression.fieldName]
+        matchValue = expression.fieldValue
 
         if expression.flags is not None:
             raise NotImplementedError("Unknown query flags: %s" % (expression.flags,))
 
         if expression.matchType == MatchType.startsWith:
-            raise NotImplementedError("Handle MatchType.startsWith")
+            indexKeys = (key for key in fieldIndex if key.startswith(matchValue))
         elif expression.matchType == MatchType.contains:
-            raise NotImplementedError("Handle MatchType.contains")
+            indexKeys = (key for key in fieldIndex if matchValue in key)
         elif expression.matchType == MatchType.equals:
             indexKeys = (expression.fieldValue,)
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130214/8fe7ce5e/attachment.html>


More information about the calendarserver-changes mailing list