[CalendarServer-changes] [2925] CalendarServer/trunk/twistedcaldav/ical.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 2 12:46:20 PDT 2008


Revision: 2925
          http://trac.macosforge.org/projects/calendarserver/changeset/2925
Author:   cdaboo at apple.com
Date:     2008-09-02 12:46:19 -0700 (Tue, 02 Sep 2008)
Log Message:
-----------
It is better to hash the string representation as the .value() may be in transformed state or not, but we want
the hash to be the same not matter what.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/ical.py

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2008-09-02 18:14:35 UTC (rev 2924)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2008-09-02 19:46:19 UTC (rev 2925)
@@ -88,10 +88,7 @@
     def __repr__(self): return "<%s: %r: %r>" % (self.__class__.__name__, self.name(), self.value())
 
     def __hash__(self):
-        if type(self.value()) is ListType:
-            return hash((self.name(), tuple(self.value())))
-        else:
-            return hash((self.name(), self.value()))
+        return hash(str(self))
 
     def __ne__(self, other): return not self.__eq__(other)
     def __eq__(self, other):
@@ -295,7 +292,7 @@
     def __repr__(self): return "<%s: %r>" % (self.__class__.__name__, str(self._vobject))
 
     def __hash__(self):
-        return hash(tuple(sorted(self.properties())))
+        return hash(str(self))
 
     def __ne__(self, other): return not self.__eq__(other)
     def __eq__(self, other):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080902/80c5ef59/attachment-0001.html 


More information about the calendarserver-changes mailing list