[CalendarServer-changes] [3047] CalendarServer/branches/users/sagen/principal-property-search-3029/ lib-patches/Twisted/twisted.web2.dav.method. report_principal_property_search.patch
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 24 13:13:35 PDT 2008
Revision: 3047
http://trac.macosforge.org/projects/calendarserver/changeset/3047
Author: sagen at apple.com
Date: 2008-09-24 13:13:34 -0700 (Wed, 24 Sep 2008)
Log Message:
-----------
Adds "caseless" (yes/no) and "match-type" (starts-with/contains) XML attributes to "match" element
Modified Paths:
--------------
CalendarServer/branches/users/sagen/principal-property-search-3029/lib-patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch
Modified: CalendarServer/branches/users/sagen/principal-property-search-3029/lib-patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch
===================================================================
--- CalendarServer/branches/users/sagen/principal-property-search-3029/lib-patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch 2008-09-24 19:10:38 UTC (rev 3046)
+++ CalendarServer/branches/users/sagen/principal-property-search-3029/lib-patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch 2008-09-24 20:13:34 UTC (rev 3047)
@@ -22,7 +22,31 @@
# Get a single DAV:prop element from the REPORT request body
propertiesForResource = None
propElement = None
-@@ -93,73 +99,155 @@
+@@ -71,9 +77,22 @@
+ elif child.qname() == (dav_namespace, "property-search"):
+ props = child.childOfType(davxml.PropertyContainer)
+ props.removeWhitespaceNodes()
++
+ match = child.childOfType(davxml.Match)
+- propertySearches.append((props.children, str(match).lower()))
++ caseless = match.attributes.get("caseless", "yes")
++ if caseless not in ("yes", "no"):
++ raise ValueError("Unknown value for caseless attribute: %s" %
++ (caseless,))
++ caseless = True if caseless == "yes" else False
++ matchType = match.attributes.get("match-type", "contains")
++ if matchType not in ("starts-with", "contains"):
++ raise ValueError("Unknown value for match-type attribute: %s" %
++ (matchType,))
++
++ propertySearches.append((props.children, str(match),
++ caseless, matchType))
+
++ # TODO: support caseless and matchType
+ def nodeMatch(node, match):
+ """
+ See if the content of the supplied node matches the supplied text.
+@@ -93,73 +112,156 @@
else:
return False
@@ -46,7 +70,7 @@
- if propvalue and not nodeMatch(propvalue, match):
+
+ if operand == "and":
-+ for props, match in propertySearches:
++ for props, match, caseless, matchType in propertySearches:
+ # Test each property
+ for prop in props:
+ try:
@@ -71,7 +95,7 @@
+ yield True
+ else: # "or"
-+ for props, match in propertySearches:
++ for props, match, caseless, matchType in propertySearches:
+ # Test each property
+ for prop in props:
+ try:
@@ -99,7 +123,7 @@
+ # See if we can take advantage of the directory
+ fields = []
+ nonDirectorySearches = []
-+ for props, match in propertySearches:
++ for props, match, caseless, matchType in propertySearches:
+ nonDirectoryProps = []
+ for prop in props:
+ try:
@@ -107,11 +131,12 @@
+ except AttributeError:
+ fieldName = None
+ if fieldName:
-+ fields.append((fieldName, match))
++ fields.append((fieldName, match, caseless, matchType))
+ else:
+ nonDirectoryProps.append(prop)
+ if nonDirectoryProps:
-+ nonDirectorySearches.append((nonDirectoryProps, match))
++ nonDirectorySearches.append((nonDirectoryProps, match,
++ caseless, matchType))
+
+ matchingResources = []
matchcount = 0
@@ -224,7 +249,7 @@
yield d
d = d.getResult()
if d:
-@@ -167,18 +255,26 @@
+@@ -167,18 +269,26 @@
matchcount += 1
if matchcount > max_number_of_matches:
raise NumberOfMatchesWithinLimits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080924/9f597d80/attachment.html
More information about the calendarserver-changes
mailing list