server/sources/storages.py
branchstable
changeset 5599 be94157bd754
parent 5549 ab3a69a34626
child 5625 6ee2a7b6f194
--- a/server/sources/storages.py	Wed May 26 18:32:27 2010 +0200
+++ b/server/sources/storages.py	Fri May 28 08:05:17 2010 +0200
@@ -125,17 +125,18 @@
 
     def entity_updated(self, entity, attr):
         """an entity using this storage for attr has been updatded"""
+        oldpath = self.current_fs_path(entity, attr)
         if entity._cw.transaction_data.get('fs_importing'):
-            oldpath = self.current_fs_path(entity, attr)
             fpath = entity[attr].getvalue()
-            if oldpath != fpath:
-                hook.set_operation(entity._cw, 'bfss_deleted', oldpath,
-                                   DeleteFileOp)
             binary = Binary(file(fpath).read())
         else:
             binary = entity.pop(attr)
-            fpath = self.current_fs_path(entity, attr)
+            fpath = self.new_fs_path(entity, attr)
             UpdateFileOp(entity._cw, filepath=fpath, filedata=binary.getvalue())
+        if oldpath != fpath:
+            entity[attr] = Binary(fpath)
+            hook.set_operation(entity._cw, 'bfss_deleted', oldpath,
+                               DeleteFileOp)
         return binary
 
     def entity_deleted(self, entity, attr):