Title: [commits] (jeffrey) [11287] - Make calendar event comparison functions into strict partial orderings.
Revision
11287
Author
jeffrey
Date
2006-07-31 11:49:11 -0700 (Mon, 31 Jul 2006)

Log Message

- Make calendar event comparison functions into strict partial orderings.
For datetime attributes that returned None (interpreted as negative
infinity), comparisons weren't satisfying antisymmetry, i.e.
a < b implies b > a.

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/pim/calendar/Calendar.py (11286 => 11287)

--- trunk/chandler/parcels/osaf/pim/calendar/Calendar.py	2006-07-31 18:46:36 UTC (rev 11286)
+++ trunk/chandler/parcels/osaf/pim/calendar/Calendar.py	2006-07-31 18:49:11 UTC (rev 11287)
@@ -1575,12 +1575,17 @@
     def cmpTimeAttribute(self, item, attr, useTZ=True):
         """Compare item and self.attr, ignore timezones if useTZ is False."""
         itemTime = getattr(item, attr, None)
+        selfTime = getattr(self, attr, None)
+
         if itemTime is None:
-            return -1
+            if selfTime is None:
+                # both attributes are None, so item and self compare as equal
+                return 0
+            else:
+                return -1
         elif not useTZ:
             itemTime = itemTime.replace(tzinfo = None)
 
-        selfTime = getattr(self, attr, None)
         if selfTime is None:
             return 1
         elif not useTZ:




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to