← Back to team overview

duplicity-team team mailing list archive

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

 

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

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/u1-ignore-404/+merge/65405

Ignore 404 errors when we try to delete a file on Ubuntu One.
-- 
https://code.launchpad.net/~mterry/duplicity/u1-ignore-404/+merge/65405
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/u1-ignore-404 into lp:duplicity.
=== modified file 'duplicity/backends/u1backend.py'
--- duplicity/backends/u1backend.py	2011-06-13 13:34:10 +0000
+++ duplicity/backends/u1backend.py	2011-06-21 20:14:25 +0000
@@ -98,7 +98,7 @@
         import urllib
         return urllib.quote(url, safe="/~")
 
-    def handle_error(self, op, headers, file1=None, file2=None):
+    def handle_error(self, op, headers, file1=None, file2=None, ignore=None):
         from duplicity import log
         from duplicity import util
         import json
@@ -107,6 +107,9 @@
         if status >= 200 and status < 300:
             return
 
+        if ignore and status in ignore:
+            return
+
         if status == 400:
             code = log.ErrorCode.backend_permission_denied
         elif status == 404:
@@ -192,7 +195,7 @@
         for filename in filename_list:
             remote_full = self.meta_base + self.quote(filename)
     	    answer = auth.request(remote_full, http_method="DELETE")
-            self.handle_error('delete', answer, remote_full)
+            self.handle_error('delete', answer, remote_full, ignore=[404])
 
 duplicity.backend.register_backend("u1", U1Backend)
 duplicity.backend.register_backend("u1+http", U1Backend)


Follow ups