server/sources/storages.py
branchstable
changeset 8743 27a83746aebd
parent 8695 358d8bed9626
child 8900 010a59e12d89
--- a/server/sources/storages.py	Tue Mar 19 16:56:46 2013 +0100
+++ b/server/sources/storages.py	Wed Mar 20 17:40:25 2013 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -144,7 +144,7 @@
         fpath = source.binary_to_str(value)
         try:
             return Binary.from_file(fpath)
-        except EnvironmentError, ex:
+        except EnvironmentError as ex:
             source.critical("can't open %s: %s", value, ex)
             return None
 
@@ -152,6 +152,7 @@
         """an entity using this storage for attr has been added"""
         if entity._cw.transaction_data.get('fs_importing'):
             binary = Binary.from_file(entity.cw_edited[attr].getvalue())
+            entity._cw_dont_cache_attribute(attr, repo_side=True)
         else:
             binary = entity.cw_edited.pop(attr)
             fpath = self.new_fs_path(entity, attr)
@@ -170,6 +171,7 @@
             # We do not need to create it but we need to fetch the content of
             # the file as the actual content of the attribute
             fpath = entity.cw_edited[attr].getvalue()
+            entity._cw_dont_cache_attribute(attr, repo_side=True)
             assert fpath is not None
             binary = Binary.from_file(fpath)
         else:
@@ -262,7 +264,7 @@
         for filepath in self.get_data():
             try:
                 unlink(filepath)
-            except Exception, ex:
+            except Exception as ex:
                 self.error('cant remove %s: %s' % (filepath, ex))
 
 class DeleteFileOp(hook.DataOperationMixIn, hook.Operation):
@@ -270,5 +272,5 @@
         for filepath in self.get_data():
             try:
                 unlink(filepath)
-            except Exception, ex:
+            except Exception as ex:
                 self.error('cant remove %s: %s' % (filepath, ex))