server/sources/storages.py
changeset 8307 8be58694f416
parent 8180 1f6ba9afb925
parent 8300 87c72dccf7b9
child 8544 3d049071957e
--- a/server/sources/storages.py	Thu Mar 15 14:26:12 2012 +0100
+++ b/server/sources/storages.py	Fri Mar 16 10:29:15 2012 +0100
@@ -194,16 +194,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):