entity.py
changeset 9261 1dfe62a9da50
parent 9256 697a8181ba30
child 9283 5f2c5eb1a820
--- a/entity.py	Fri Oct 04 18:16:45 2013 +0200
+++ b/entity.py	Tue Oct 08 10:46:06 2013 +0200
@@ -537,7 +537,14 @@
         raise NotImplementedError('comparison not implemented for %s' % self.__class__)
 
     def __eq__(self, other):
-        raise NotImplementedError('comparison not implemented for %s' % self.__class__)
+        if isinstance(self.eid, (int, long)):
+            return self.eid == other.eid
+        return self is other
+
+    def __hash__(self):
+        if isinstance(self.eid, (int, long)):
+            return self.eid
+        return super(Entity, self).__hash__()
 
     def _cw_update_attr_cache(self, attrcache):
         # if context is a repository session, don't consider dont-cache-attrs as