You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/03/08 13:00:02 UTC

svn commit: r1079334 - /incubator/libcloud/trunk/libcloud/storage/base.py

Author: tomaz
Date: Tue Mar  8 12:00:01 2011
New Revision: 1079334

URL: http://svn.apache.org/viewvc?rev=1079334&view=rev
Log:
Oops, this whole body shouldn't be wrapped inside "if calculate_hash"

Modified:
    incubator/libcloud/trunk/libcloud/storage/base.py

Modified: incubator/libcloud/trunk/libcloud/storage/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/base.py?rev=1079334&r1=1079333&r2=1079334&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/base.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/base.py Tue Mar  8 12:00:01 2011
@@ -444,27 +444,26 @@ class StorageDriver(object):
             return False, None, None
 
         while len(chunk) > 0:
+            try:
+                if chunked:
+                    response.connection.connection.send('%X\r\n' %
+                                                       (len(chunk)))
+                    response.connection.connection.send(chunk)
+                    response.connection.connection.send('\r\n')
+                else:
+                    response.connection.connection.send(chunk)
+            except Exception, e:
+                # Timeout, etc.
+                return False, None, bytes_transferred
+
+            bytes_transferred += len(chunk)
             if calculate_hash:
-                try:
-                    if chunked:
-                        response.connection.connection.send('%X\r\n' %
-                                                           (len(chunk)))
-                        response.connection.connection.send(chunk)
-                        response.connection.connection.send('\r\n')
-                    else:
-                        response.connection.connection.send(chunk)
-                except Exception, e:
-                    # Timeout, etc.
-                    return False, None, bytes_transferred
-
-                bytes_transferred += len(chunk)
-                if calculate_hash:
-                    data_hash.update(chunk)
-
-                try:
-                    chunk = generator.next()
-                except StopIteration:
-                    chunk = ''
+                data_hash.update(chunk)
+
+            try:
+                chunk = generator.next()
+            except StopIteration:
+                chunk = ''
 
         if chunked:
                 response.connection.connection.send('0\r\n\r\n')