Small optimization...
authorThierry Florac <thierry.florac@onf.fr>
Wed, 18 Mar 2015 10:08:44 +0100
changeset 5 aa402a05ef0e
parent 4 4070bf0c5d9e
child 6 f96107cb3c35
Small optimization...
src/pyams_file/file.py
--- a/src/pyams_file/file.py	Tue Mar 17 17:13:25 2015 +0100
+++ b/src/pyams_file/file.py	Wed Mar 18 10:08:44 2015 +0100
@@ -237,10 +237,11 @@
         raise ResumeCopy
 
     def _copy_blob(self, translate):
-        if self.context._blob is not None:
+        blob = self.context._blob
+        if blob is not None:
             target = translate(self.context)
             target._blob = Blob()
-            fsrc = self.context._blob.open('r')
+            fsrc = blob.open('r')
             fdst = target._blob.open('w')
             shutil.copyfileobj(fsrc, fdst)
             fdst.close()