Commit 5d613f4a authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

[storage/bfss] ensure bfss never remove a cw_edited item (closes #2236287)

When the <old value> == <new value> (not really and update but can happen), the
value was popped but never restored. The cw_edited attribut had wrong content
for a small time lapse.

--HG--
branch : stable
parent f23782a2cdee
......@@ -175,16 +175,16 @@ class BytesFileSystemStorage(Storage):
# Mark the new file as added during the transaction.
# The file will be removed on rollback
AddFileOp.get_instance(entity._cw).add_data(fpath)
if oldpath != fpath:
# register the new location for the file.
# reinstall poped value
if fpath is None:
entity.cw_edited.edited_attribute(attr, None)
else:
# register the new location for the file.
entity.cw_edited.edited_attribute(attr, Binary(fpath))
if oldpath is not None and oldpath != fpath:
# Mark the old file as useless so the file will be removed at
# commit.
if oldpath is not None:
DeleteFileOp.get_instance(entity._cw).add_data(oldpath)
DeleteFileOp.get_instance(entity._cw).add_data(oldpath)
return binary
def entity_deleted(self, entity, attr):
......
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