entity.py
branchstable
changeset 3665 42f3a66cab51
parent 3664 af7ca3597b8d
child 3671 c765adac7f5c
equal deleted inserted replaced
3664:af7ca3597b8d 3665:42f3a66cab51
   843         else:
   843         else:
   844             assert role
   844             assert role
   845             self._related_cache.pop('%s_%s' % (rtype, role), None)
   845             self._related_cache.pop('%s_%s' % (rtype, role), None)
   846 
   846 
   847     def clear_all_caches(self):
   847     def clear_all_caches(self):
       
   848         haseid = 'eid' in self
   848         self.clear()
   849         self.clear()
   849         for rschema, _, role in self.e_schema.relation_definitions():
   850         for rschema, _, role in self.e_schema.relation_definitions():
   850             self.clear_related_cache(rschema.type, role)
   851             self.clear_related_cache(rschema.type, role)
       
   852         # set eid if it was in, else we may get nasty error while editing this
       
   853         # entity if it's bound to a repo session
       
   854         if haseid:
       
   855             self['eid'] = self.eid
   851 
   856 
   852     # raw edition utilities ###################################################
   857     # raw edition utilities ###################################################
   853 
   858 
   854     def set_attributes(self, _cw_unsafe=False, **kwargs):
   859     def set_attributes(self, _cw_unsafe=False, **kwargs):
   855         assert kwargs
   860         assert kwargs