Return an int for __hash__

This commit is contained in:
Guillaume Ayoub 2013-10-31 14:05:15 +01:00
parent 92b3cf41bc
commit a920518a26
2 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@
* Support colors (by Jochen Sprickerhof)
* Decode URLs in XML (by Jean-Marc Martins)
* Fix PAM authentication (by Stepan Henek)
* Use consistent hashes for etags (by 9m66p93w)
* Use consistent etags (by 9m66p93w)
0.8 - Rainbow

View File

@ -110,9 +110,7 @@ class Item(object):
"\nEND:", "\nX-RADICALE-NAME:%s\nEND:" % self._name)
def __hash__(self):
md5 = hashlib.md5()
md5.update(self.text.encode("utf-8"))
return md5.hexdigest()
return hash(self.text)
def __eq__(self, item):
return isinstance(item, Item) and self.text == item.text
@ -124,7 +122,9 @@ class Item(object):
Etag is mainly used to know if an item has changed.
"""
return '"%s"' % hash(self)
md5 = hashlib.md5()
md5.update(self.text.encode("utf-8"))
return '"%s"' % md5.hexdigest()
@property
def name(self):