[bw compat] fix compat for entity.attr assigment
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 15 Oct 2010 11:25:51 +0200
changeset 6498 0ad62d6b6f8e
parent 6497 84fbd09f8c6b
child 6499 c4123c741c66
[bw compat] fix compat for entity.attr assigment
entity.py
--- a/entity.py	Thu Oct 14 17:32:36 2010 +0200
+++ b/entity.py	Fri Oct 15 11:25:51 2010 +0200
@@ -1096,7 +1096,10 @@
 
     @deprecated('[3.10] use entity.cw_attr_cache[attr] = value')
     def __set__(self, eobj, value):
-        eobj.cw_attr_cache[self._attrname] = value
+        if hasattr(eobj, 'cw_edited') and not eobj.cw_edited.saved:
+            eobj.cw_edited[self._attrname] = value
+        else:
+            eobj.cw_attr_cache[self._attrname] = value
 
 
 class Relation(object):