Commit ef655d01 authored by Alexandre Boeglin's avatar Alexandre Boeglin

When property A depends on property B, or Property A and B are acquired

ContentProperties, and only one of them is changed, _edit()'s behaviour could
have been unpredictable.

This is fixed by looping once more over unordered and unmodified properties.
Ordered properties (through edit_order) are not affected.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20052 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aaed70ab
...@@ -1541,12 +1541,13 @@ class Base( CopyContainer, ...@@ -1541,12 +1541,13 @@ class Base( CopyContainer,
modified_property_dict = self._v_modified_property_dict = {} modified_property_dict = self._v_modified_property_dict = {}
key_list = kw.keys() key_list = kw.keys()
ordered_key_list = [k for k in key_list if k not in edit_order] unordered_key_list = [k for k in key_list if k not in edit_order]
for k in edit_order: ordered_key_list = [k for k in edit_order if k in key_list]
if k in key_list: second_try_key_list = []
ordered_key_list.append(k)
for key in ordered_key_list: def setChangedPropertyList(key_list):
not_modified_list = []
for key in key_list:
# We only change if the value is different # We only change if the value is different
# This may be very long... # This may be very long...
old_value = None old_value = None
...@@ -1568,6 +1569,14 @@ class Base( CopyContainer, ...@@ -1568,6 +1569,14 @@ class Base( CopyContainer,
self._setProperty(key, kw[key]) self._setProperty(key, kw[key])
else: else:
self.setId(kw['id'], reindex=reindex_object) self.setId(kw['id'], reindex=reindex_object)
else:
not_modified_list.append(key)
return not_modified_list
unmodified_key_list = setChangedPropertyList(unordered_key_list)
setChangedPropertyList(unmodified_key_list)
# edit_order MUST be enforced, and done at the complete end
setChangedPropertyList(ordered_key_list)
if reindex_object: if reindex_object:
# We do not want to reindex the object if nothing is changed # We do not want to reindex the object if nothing is changed
......
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