Commit 9db59e7d authored by Jérome Perrin's avatar Jérome Perrin

PropertyRecordableMixin: clear _recorded_property_dict if empty

This makes smaller pickles
parent 915b4640
......@@ -82,6 +82,7 @@ class TestPropertyRecordable(ERP5TypeTestCase):
p.clearRecordedProperty('first_name')
self.assertFalse(p.isPropertyRecorded('first_name'))
self.assertTrue(p.isPropertyRecorded('last_name'))
self.assertTrue(hasattr(p, '_recorded_property_dict'))
# clearing a property that is not currently recorded is not an error
p.clearRecordedProperty('description')
......@@ -89,5 +90,6 @@ class TestPropertyRecordable(ERP5TypeTestCase):
p.clearRecordedProperty('last_name')
self.assertFalse(p.isPropertyRecorded('first_name'))
self.assertFalse(p.isPropertyRecorded('last_name'))
self.assertFalse(hasattr(p, '_recorded_property_dict'))
p.clearRecordedProperty('description')
......@@ -87,6 +87,8 @@ class PropertyRecordableMixin:
the property record.
"""
self._getRecordedPropertyDict({}).pop(id, None)
if not self._getRecordedPropertyDict(True):
del self._recorded_property_dict
security.declareProtected(Permissions.AccessContentsInformation,
'getRecordedPropertyIdList')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment