entity.py
changeset 9261 1dfe62a9da50
parent 9256 697a8181ba30
child 9283 5f2c5eb1a820
equal deleted inserted replaced
9260:dd574929b414 9261:1dfe62a9da50
   535 
   535 
   536     def __lt__(self, other):
   536     def __lt__(self, other):
   537         raise NotImplementedError('comparison not implemented for %s' % self.__class__)
   537         raise NotImplementedError('comparison not implemented for %s' % self.__class__)
   538 
   538 
   539     def __eq__(self, other):
   539     def __eq__(self, other):
   540         raise NotImplementedError('comparison not implemented for %s' % self.__class__)
   540         if isinstance(self.eid, (int, long)):
       
   541             return self.eid == other.eid
       
   542         return self is other
       
   543 
       
   544     def __hash__(self):
       
   545         if isinstance(self.eid, (int, long)):
       
   546             return self.eid
       
   547         return super(Entity, self).__hash__()
   541 
   548 
   542     def _cw_update_attr_cache(self, attrcache):
   549     def _cw_update_attr_cache(self, attrcache):
   543         # if context is a repository session, don't consider dont-cache-attrs as
   550         # if context is a repository session, don't consider dont-cache-attrs as
   544         # the instance already hold modified values and loosing them could
   551         # the instance already hold modified values and loosing them could
   545         # introduce severe problems
   552         # introduce severe problems