[CalendarServer-changes] [13563] twext/trunk/twext/who/expression.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 29 15:36:05 PDT 2014
Revision: 13563
http://trac.calendarserver.org//changeset/13563
Author: wsanchez at apple.com
Date: 2014-05-29 15:36:05 -0700 (Thu, 29 May 2014)
Log Message:
-----------
Add some equality
Modified Paths:
--------------
twext/trunk/twext/who/expression.py
Modified: twext/trunk/twext/who/expression.py
===================================================================
--- twext/trunk/twext/who/expression.py 2014-05-29 19:18:54 UTC (rev 13562)
+++ twext/trunk/twext/who/expression.py 2014-05-29 22:36:05 UTC (rev 13563)
@@ -74,7 +74,17 @@
)
+ def __eq__(self, other):
+ if isinstance(other, CompoundExpression):
+ return (
+ (self.operand is other.operand) and
+ (self.expressions == other.expressions)
+ )
+ else:
+ return NotImplemented
+
+
#
# Match expression
#
@@ -261,6 +271,18 @@
)
+ def __eq__(self, other):
+ if isinstance(other, MatchExpression):
+ return (
+ (self.fieldName is other.fieldName) and
+ (self.matchType is other.matchType) and
+ (set(self.flags) == set(other.flags)) and
+ (self.fieldValue == other.fieldValue)
+ )
+ else:
+ return NotImplemented
+
+
def match(self, value):
"""
Test whether this expression's field value matches against a given
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140529/d86df3fd/attachment-0001.html>
More information about the calendarserver-changes
mailing list