Return an int for __hash__
This commit is contained in:
		
							
								
								
									
										2
									
								
								NEWS.rst
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NEWS.rst
									
									
									
									
									
								
							| @@ -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 | ||||
|   | ||||
| @@ -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): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guillaume Ayoub
					Guillaume Ayoub