1.1 --- a/EventAggregatorSupport.py Sun Jul 24 00:47:10 2011 +0200
1.2 +++ b/EventAggregatorSupport.py Sun Jul 24 00:58:52 2011 +0200
1.3 @@ -1059,13 +1059,31 @@
1.4 def __contains__(self, other):
1.5 return self == other
1.6
1.7 - def __cmp__(self, other):
1.8 + def __eq__(self, other):
1.9 + if isinstance(other, Event):
1.10 + return self.getSummary() == other.getSummary() and self.getEventURL() == other.getEventURL() and self._cmp(other)
1.11 + else:
1.12 + return self._cmp(other) == 0
1.13 +
1.14 + def __ne__(self, other):
1.15 + return not self.__eq__(other)
1.16 +
1.17 + def __lt__(self, other):
1.18 + return self._cmp(other) == -1
1.19 +
1.20 + def __le__(self, other):
1.21 + return self._cmp(other) in (-1, 0)
1.22 +
1.23 + def __gt__(self, other):
1.24 + return self._cmp(other) == 1
1.25 +
1.26 + def __ge__(self, other):
1.27 + return self._cmp(other) in (0, 1)
1.28 +
1.29 + def _cmp(self, other):
1.30
1.31 "Compare this event to an 'other' event purely by their timespans."
1.32
1.33 - # NOTE: This could be replaced by rich comparison methods and provide
1.34 - # NOTE: more effective equality testing.
1.35 -
1.36 if isinstance(other, Event):
1.37 return cmp(self.as_timespan(), other.as_timespan())
1.38 else: