← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/u1-status into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/u1-status into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/u1-status/+merge/64404

Further testing with the u1 backend has revealed that the server sometimes returns other success status codes like 201.  So I've changed the 'did we get an error?' logic to treat any 2xx status code as a success.
-- 
https://code.launchpad.net/~mterry/duplicity/u1-status/+merge/64404
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/u1-status into lp:duplicity.
=== modified file 'duplicity/backends/u1backend.py'
--- duplicity/backends/u1backend.py	2011-05-24 13:21:04 +0000
+++ duplicity/backends/u1backend.py	2011-06-13 13:42:54 +0000
@@ -103,15 +103,15 @@
         from duplicity import util
         import json
 
-        status = headers[0].get('status')
-        if status == '200':
+        status = int(headers[0].get('status'))
+        if status >= 200 and status < 300:
             return
 
-        if status == '400':
+        if status == 400:
             code = log.ErrorCode.backend_permission_denied
-        elif status == '404':
+        elif status == 404:
             code = log.ErrorCode.backend_not_found
-        elif status == '500': # wish this were a more specific error
+        elif status == 500: # wish this were a more specific error
             code = log.ErrorCode.backend_no_space
         else:
             code = log.ErrorCode.backend_error


Follow ups