entity.py
changeset 5980 6dc04e75c8e1
parent 5870 d3ec7c4bb373
child 6085 8a059eefac75
equal deleted inserted replaced
5979:561b6c2eb288 5980:6dc04e75c8e1
   380     def get(self, key, default=None):
   380     def get(self, key, default=None):
   381         return self.cw_attr_cache.get(key, default)
   381         return self.cw_attr_cache.get(key, default)
   382 
   382 
   383     def setdefault(self, attr, default):
   383     def setdefault(self, attr, default):
   384         """override setdefault to update self.edited_attributes"""
   384         """override setdefault to update self.edited_attributes"""
   385         self.cw_attr_cache.setdefault(attr, default)
   385         value = self.cw_attr_cache.setdefault(attr, default)
   386         # don't add attribute into skip_security if already in edited
   386         # don't add attribute into skip_security if already in edited
   387         # attributes, else we may accidentaly skip a desired security check
   387         # attributes, else we may accidentaly skip a desired security check
   388         if hasattr(self, 'edited_attributes') and \
   388         if hasattr(self, 'edited_attributes') and \
   389                attr not in self.edited_attributes:
   389                attr not in self.edited_attributes:
   390             self.edited_attributes.add(attr)
   390             self.edited_attributes.add(attr)
   391             self._cw_skip_security_attributes.add(attr)
   391             self._cw_skip_security_attributes.add(attr)
       
   392         return value
   392 
   393 
   393     def pop(self, attr, default=_marker):
   394     def pop(self, attr, default=_marker):
   394         """override pop to update self.edited_attributes on cleanup of
   395         """override pop to update self.edited_attributes on cleanup of
   395         undesired changes introduced in the entity's dict. See `__delitem__`
   396         undesired changes introduced in the entity's dict. See `__delitem__`
   396         """
   397         """