[CalendarServer-changes] [3546] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Dec 18 17:53:45 PST 2008
Revision: 3546
http://trac.macosforge.org/projects/calendarserver/changeset/3546
Author: sagen at apple.com
Date: 2008-12-18 17:53:45 -0800 (Thu, 18 Dec 2008)
Log Message:
-----------
principal-property-search REPORT gets a new match-type: "exact" (in addition to "starts-with" and "contains")
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
CalendarServer/trunk/twistedcaldav/directory/directory.py
CalendarServer/trunk/twistedcaldav/extensions.py
Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2008-12-18 04:47:28 UTC (rev 3545)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2008-12-19 01:53:45 UTC (rev 3546)
@@ -394,8 +394,10 @@
ODField = self._ODFields[field]
if matchType == "starts-with":
comparison = dsattributes.eDSStartsWith
+ elif matchType == "contains":
+ comparison = dsattributes.eDSContains
else:
- comparison = dsattributes.eDSContains
+ comparison = dsattributes.eDSExact
expressions.append(dsquery.match(ODField, value, comparison))
Modified: CalendarServer/trunk/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/directory.py 2008-12-18 04:47:28 UTC (rev 3545)
+++ CalendarServer/trunk/twistedcaldav/directory/directory.py 2008-12-19 01:53:45 UTC (rev 3546)
@@ -169,13 +169,15 @@
value = value.lower()
if matchType == 'starts-with':
- return fieldValue.lower().startswith(value.lower())
- else:
+ return fieldValue.startswith(value)
+ elif matchType == 'contains':
try:
- discard = fieldValue.lower().index(value.lower())
+ discard = fieldValue.index(value)
return True
except ValueError:
return False
+ else: # exact
+ return fieldValue == value
def recordMatches(record):
if operand == "and":
Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py 2008-12-18 04:47:28 UTC (rev 3545)
+++ CalendarServer/trunk/twistedcaldav/extensions.py 2008-12-19 01:53:45 UTC (rev 3546)
@@ -270,7 +270,7 @@
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
caseless = (caseless == "yes")
matchType = match.attributes.get("match-type", "contains")
- if matchType not in ("starts-with", "contains"):
+ if matchType not in ("starts-with", "contains", "exact"):
msg = "Bad XML: unknown value for match-type attribute: %s" % (matchType,)
log.warn(msg)
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081218/0e9963ba/attachment.html>
More information about the calendarserver-changes
mailing list