[CalendarServer-changes] [8976] CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav /directory/opendirectorybacker.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 3 18:17:49 PDT 2012
Revision: 8976
http://trac.macosforge.org/projects/calendarserver/changeset/8976
Author: gaya at apple.com
Date: 2012-04-03 18:17:47 -0700 (Tue, 03 Apr 2012)
Log Message:
-----------
if only one propFilter, then use filterAllOf as propFilterAllOf to reduce subexpressions and simplify generated query string
Modified Paths:
--------------
CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py
Modified: CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py 2012-04-04 00:12:44 UTC (rev 8975)
+++ CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py 2012-04-04 01:17:47 UTC (rev 8976)
@@ -534,7 +534,7 @@
def andOrExpression(propFilterAllOf, queryAttributes, matchList):
#print("andOrExpression(propFilterAllOf=%r, queryAttributes%r, matchList%r)" % (propFilterAllOf, queryAttributes, matchList))
- if propFilterAllOf and len(matchList):
+ if propFilterAllOf and len(matchList) > 1:
# add OR expression because parent will AND
return (False, queryAttributes, [dsquery.expression( dsquery.expression.OR, matchList),])
else:
@@ -735,8 +735,13 @@
paramFilterElements = [paramFilterElement for paramFilterElement in propFilter.filters if isinstance(paramFilterElement, addressbookqueryfilter.ParameterFilter)]
textMatchElements = [textMatchElement for textMatchElement in propFilter.filters if isinstance(textMatchElement, addressbookqueryfilter.TextMatch)]
- propFilterAllOf = propFilter.propfilter_test == "allof"
+ # if only one propFilter, then use filterAllOf as propFilterAllOf to reduce subexpressions and simplify generated query string
+ if len(propFilter.filters) == 1:
+ propFilterAllOf = filterAllOf
+ else:
+ propFilterAllOf = propFilter.propfilter_test == "allof"
+
# handle parameter filter elements
if len(paramFilterElements) > 0:
if supportedParamter(propFilter.filter_name, paramFilterElements, propFilterAllOf ):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120403/aa555683/attachment.html>
More information about the calendarserver-changes
mailing list