entity.py
branchstable
changeset 3665 42f3a66cab51
parent 3664 af7ca3597b8d
child 3671 c765adac7f5c
--- a/entity.py	Wed Oct 14 12:48:51 2009 +0200
+++ b/entity.py	Wed Oct 14 12:49:20 2009 +0200
@@ -845,9 +845,14 @@
             self._related_cache.pop('%s_%s' % (rtype, role), None)
 
     def clear_all_caches(self):
+        haseid = 'eid' in self
         self.clear()
         for rschema, _, role in self.e_schema.relation_definitions():
             self.clear_related_cache(rschema.type, role)
+        # set eid if it was in, else we may get nasty error while editing this
+        # entity if it's bound to a repo session
+        if haseid:
+            self['eid'] = self.eid
 
     # raw edition utilities ###################################################