[entity] fix setdefault implementation: should return actual value
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 16 Jul 2010 11:39:28 +0200
changeset 5980 6dc04e75c8e1
parent 5979 561b6c2eb288
child 5981 3472c051da77
[entity] fix setdefault implementation: should return actual value
entity.py
--- a/entity.py	Fri Jul 16 11:00:42 2010 +0200
+++ b/entity.py	Fri Jul 16 11:39:28 2010 +0200
@@ -382,13 +382,14 @@
 
     def setdefault(self, attr, default):
         """override setdefault to update self.edited_attributes"""
-        self.cw_attr_cache.setdefault(attr, default)
+        value = self.cw_attr_cache.setdefault(attr, default)
         # don't add attribute into skip_security if already in edited
         # attributes, else we may accidentaly skip a desired security check
         if hasattr(self, 'edited_attributes') and \
                attr not in self.edited_attributes:
             self.edited_attributes.add(attr)
             self._cw_skip_security_attributes.add(attr)
+        return value
 
     def pop(self, attr, default=_marker):
         """override pop to update self.edited_attributes on cleanup of