[CalendarServer-changes] [327]
CalendarServer/trunk/twistedcaldav/caldavxml.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 27 14:14:24 PDT 2006
Revision: 327
http://trac.macosforge.org/projects/calendarserver/changeset/327
Author: cdaboo at apple.com
Date: 2006-10-27 14:14:23 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
Fix for text comparisons on multi-valied text properties (e.g., CATEGORIES).
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/caldavxml.py
Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py 2006-10-27 21:12:54 UTC (rev 326)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py 2006-10-27 21:14:23 UTC (rev 327)
@@ -1126,13 +1126,28 @@
test = str(self)
if self.caseless:
test = test.lower()
- for value in values:
+
+ def _textCompare(s):
if self.caseless:
- if value.lower().find(test) != -1:
- return not self.negate
+ if s.lower().find(test) != -1:
+ return True, not self.negate
else:
- if value.find(test) != -1:
- return not self.negate
+ if s.find(test) != -1:
+ return True, not self.negate
+ return False, False
+
+ for value in values:
+ # NB Its possible that we have a text list value which appears as a Pythin list,
+ # so we need to check for that an iterate over thr list.
+ if isinstance(value, list):
+ for subvalue in value:
+ matched, result = _textCompare(subvalue)
+ if matched:
+ return result
+ else:
+ matched, result = _textCompare(value)
+ if matched:
+ return result
return self.negate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061027/f64e8bf0/attachment.html
More information about the calendarserver-changes
mailing list