entity.py
branchstable
changeset 5009 2ac04bc976c3
parent 4991 16f0cec3d008
child 5115 2e43ef618d14
--- a/entity.py	Thu Mar 25 13:41:26 2010 +0100
+++ b/entity.py	Thu Mar 25 13:42:17 2010 +0100
@@ -286,6 +286,18 @@
             self.edited_attributes.add(attr)
             self.skip_security_attributes.add(attr)
 
+    def pop(self, attr, default=_marker):
+        """override pop to update self.edited_attributes on cleanup of
+        undesired changes introduced in the entity's dict. See `__delitem__`
+        """
+        if default is _marker:
+            value = super(Entity, self).pop(attr)
+        else:
+            value = super(Entity, self).pop(attr, default)
+        if hasattr(self, 'edited_attributes') and attr in self.edited_attributes:
+            self.edited_attributes.remove(attr)
+        return value
+
     def rql_set_value(self, attr, value):
         """call by rql execution plan when some attribute is modified