[CalendarServer-changes] [7585] CalendarServer/trunk/twistedcaldav/query

source_changes at macosforge.org source_changes at macosforge.org
Mon Jun 13 13:00:32 PDT 2011


Revision: 7585
          http://trac.macosforge.org/projects/calendarserver/changeset/7585
Author:   cdaboo at apple.com
Date:     2011-06-13 13:00:32 -0700 (Mon, 13 Jun 2011)
Log Message:
-----------
calendar-query always defaults to logical AND of terms.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/query/calendarquery.py
    CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py

Modified: CalendarServer/trunk/twistedcaldav/query/calendarquery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/query/calendarquery.py	2011-06-13 19:59:00 UTC (rev 7584)
+++ CalendarServer/trunk/twistedcaldav/query/calendarquery.py	2011-06-13 20:00:32 UTC (rev 7585)
@@ -67,7 +67,7 @@
     if len(compfilters) == 1:
         return compfilterExpression(compfilters[0], fields)
     else:
-        return expression.orExpression([compfilterExpression(c, fields) for c in compfilters])
+        return expression.andExpression([compfilterExpression(c, fields) for c in compfilters])
 
 def compfilterExpression(compfilter, fields):
     """
@@ -98,7 +98,7 @@
     for p in [x for x in compfilter.filters if isinstance(x, calendarqueryfilter.PropertyFilter)]:
         props.append(propfilterExpression(p, fields))
     if len(props) > 1:
-        propsExpression = expression.orExpression[props]
+        propsExpression = expression.andExpression[props]
     elif len(props) == 1:
         propsExpression = props[0]
     else:
@@ -109,7 +109,7 @@
     for _ignore in [x for x in compfilter.filters if isinstance(x, calendarqueryfilter.ComponentFilter)]:
         raise ValueError
     if len(comps) > 1:
-        compsExpression = expression.orExpression[comps]
+        compsExpression = expression.andExpression[comps]
     elif len(comps) == 1:
         compsExpression = comps[0]
     else:
@@ -117,7 +117,7 @@
 
     # Now build compound expression
     if ((propsExpression is not None) and (compsExpression is not None)):
-        expressions.append(expression.orExpression([propsExpression, compsExpression]))
+        expressions.append(expression.andExpression([propsExpression, compsExpression]))
     elif propsExpression is not None:
         expressions.append(propsExpression)
     elif compsExpression is not None:
@@ -160,7 +160,7 @@
     for _ignore in propfilter.filters:
         raise ValueError
     if len(params) > 1:
-        paramsExpression = expression.orExpression[params]
+        paramsExpression = expression.andExpression[params]
     elif len(params) == 1:
         paramsExpression = params[0]
     else:

Modified: CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py	2011-06-13 19:59:00 UTC (rev 7584)
+++ CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py	2011-06-13 20:00:32 UTC (rev 7585)
@@ -198,9 +198,9 @@
 
         if len(self.filters) > 0:
             for filter in self.filters:
-                if filter._match(item, access):
-                    return True
-            return False
+                if not filter._match(item, access):
+                    return False
+            return True
         else:
             return True
 
@@ -225,9 +225,9 @@
 
         if len(self.filters) > 0:
             for filter in self.filters:
-                if filter._match(item, access):
-                    return True
-            return False
+                if not filter._match(item, access):
+                    return False
+            return True
         else:
             return True
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110613/7302ef2f/attachment.html>


More information about the calendarserver-changes mailing list