← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~townsend/duplicity/fix-1161599-2 into lp:duplicity

 

Christopher Townsend has proposed merging lp:~townsend/duplicity/fix-1161599-2 into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)
Related bugs:
  Bug #1161599 in Duplicity: "Backup to Ubuntu one failed, after 5 attempts status 400 bad request"
  https://bugs.launchpad.net/duplicity/+bug/1161599

For more details, see:
https://code.launchpad.net/~townsend/duplicity/fix-1161599-2/+merge/160945

The fix in revno. 912 didn't take into account that the parameter "body" passed into request() is overloaded, so when it was NULL or of a type other than file, it would fail. This checks if "body" is of type "file" before actually seek()'ing back to the beginning of the file.
-- 
https://code.launchpad.net/~townsend/duplicity/fix-1161599-2/+merge/160945
Your team duplicity-team is requested to review the proposed merge of lp:~townsend/duplicity/fix-1161599-2 into lp:duplicity.
=== modified file 'duplicity/backends/u1backend.py'
--- duplicity/backends/u1backend.py	2013-04-19 14:57:52 +0000
+++ duplicity/backends/u1backend.py	2013-04-25 16:14:28 +0000
@@ -84,7 +84,10 @@
                           % duplicity.util.exception_traceback())
                 if n == globals.num_retries:
                     log.FatalError("Giving up on request after %d attempts, last exception %s" % (n,e))
-                body.seek(0) # Go to the beginning of the file for the retry
+
+                if isinstance(body, file):
+                    body.seek(0) # Go to the beginning of the file for the retry
+
                 time.sleep(30)
                 continue
 
@@ -106,8 +109,9 @@
                 ecode = log.ErrorCode.backend_no_space
             elif numcode == 404:
                 ecode = log.ErrorCode.backend_not_found
- 
-            body.seek(0) # Go to the beginning of the file for the retry
+
+            if isinstance(body, file):
+                body.seek(0) # Go to the beginning of the file for the retry
 
             if n < globals.num_retries:
                 time.sleep(30)


Follow ups