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

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 12 12:14:42 PDT 2014


Revision: 13634
          http://trac.calendarserver.org//changeset/13634
Author:   sagen at apple.com
Date:     2014-06-12 12:14:42 -0700 (Thu, 12 Jun 2014)
Log Message:
-----------
Work around twext.who.opendirectory problem with CompoundExpressions that become MatchExpressions once the record type portion(s) are removed.

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

Modified: CalendarServer/trunk/txdav/who/directory.py
===================================================================
--- CalendarServer/trunk/txdav/who/directory.py	2014-06-12 10:06:36 UTC (rev 13633)
+++ CalendarServer/trunk/txdav/who/directory.py	2014-06-12 19:14:42 UTC (rev 13634)
@@ -254,7 +254,19 @@
             )
             subExpressions.append(subExpression)
 
-        expression = CompoundExpression(subExpressions, operand)
+        if len(subExpressions) == 1:
+            # FIXME: twext.who.opendirectory takes a CompoundExpression and
+            # inspects it for MatchExpressions on recordType, and pulls those
+            # out of the query structure.  However, if all that remains is
+            # essentially a MatchExpression, but we tell OD to use
+            # ODMatchType.compound for it, we get no results back.  Until we
+            # fix twext.who, this workaround keeds the query compound even
+            # when the record type portion is removed:
+            expression = CompoundExpression(
+                [subExpressions[0], subExpressions[0]], operand
+            )
+        else:
+            expression = CompoundExpression(subExpressions, operand)
 
         # AND in the recordType if passed in
         if recordType is not None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140612/53fa7656/attachment.html>


More information about the calendarserver-changes mailing list