[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.
--- a/server/sources/storages.py Wed Mar 07 16:09:55 2012 +0100
+++ b/server/sources/storages.py Wed Mar 07 16:16:44 2012 +0100
@@ -175,16 +175,16 @@
# 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):