[CalendarServer-changes] [14125] CalendarServer/trunk/txdav/who/directory.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 30 11:29:09 PDT 2014


Revision: 14125
          http://trac.calendarserver.org//changeset/14125
Author:   sagen at apple.com
Date:     2014-10-30 11:29:09 -0700 (Thu, 30 Oct 2014)
Log Message:
-----------
Ignore empty search tokens

Modified Paths:
--------------
    CalendarServer/trunk/txdav/who/directory.py

Modified: CalendarServer/trunk/txdav/who/directory.py
===================================================================
--- CalendarServer/trunk/txdav/who/directory.py	2014-10-30 18:19:05 UTC (rev 14124)
+++ CalendarServer/trunk/txdav/who/directory.py	2014-10-30 18:29:09 UTC (rev 14125)
@@ -167,22 +167,24 @@
 
         outer = []
         for token in tokens:
-            inner = []
-            for name, matchType in fields:
-                inner.append(
-                    MatchExpression(
-                        self.fieldName.lookupByName(name),
-                        token,
-                        matchType,
-                        MatchFlags.caseInsensitive
+            if token:
+                token = token.strip()
+                inner = []
+                for name, matchType in fields:
+                    inner.append(
+                        MatchExpression(
+                            self.fieldName.lookupByName(name),
+                            token,
+                            matchType,
+                            MatchFlags.caseInsensitive
+                        )
                     )
+                outer.append(
+                    CompoundExpression(
+                        inner,
+                        Operand.OR
+                    )
                 )
-            outer.append(
-                CompoundExpression(
-                    inner,
-                    Operand.OR
-                )
-            )
 
         if len(outer) == 1:
             expression = outer[0]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141030/d48c214a/attachment.html>


More information about the calendarserver-changes mailing list