← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/lazy-warnings into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/lazy-warnings into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/lazy-warnings/+merge/98567

A couple more warning error codes that Deja Dup is interested in noticing.
-- 
https://code.launchpad.net/~mterry/duplicity/lazy-warnings/+merge/98567
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/lazy-warnings into lp:duplicity.
=== modified file 'duplicity/backends/giobackend.py'
--- duplicity/backends/giobackend.py	2011-08-29 00:07:48 +0000
+++ duplicity/backends/giobackend.py	2012-03-21 03:26:21 +0000
@@ -55,12 +55,23 @@
     def __init__(self, backend):
         gio.MountOperation.__init__(self)
         self.backend = backend
-        self.connect('ask-password', self.ask_password)
+        self.connect('ask-password', self.ask_password_cb)
+        self.connect('ask-question', self.ask_question_cb)
 
-    def ask_password(self, *args, **kwargs):
+    def ask_password_cb(self, *args, **kwargs):
         self.set_password(self.backend.get_password())
         self.reply(gio.MOUNT_OPERATION_HANDLED)
 
+    def ask_question_cb(self, *args, **kwargs):
+        # Obviously just always answering with the first choice is a naive
+        # approach.  But there's no easy way to allow for answering questions
+        # in duplicity's typical run-from-cron mode with environment variables.
+        # And only a couple gvfs backends ask questions: 'sftp' does about
+        # new hosts and 'afc' does if the device is locked.  0 should be a
+        # safe choice.
+        self.set_choice(0)
+        self.reply(gio.MOUNT_OPERATION_HANDLED)
+
 class GIOBackend(duplicity.backend.Backend):
     """Use this backend when saving to a GIO URL.
        This is a bit of a meta-backend, in that it can handle multiple schemas.

=== modified file 'duplicity/lazy.py'
--- duplicity/lazy.py	2010-07-22 19:15:11 +0000
+++ duplicity/lazy.py	2012-03-21 03:26:21 +0000
@@ -397,7 +397,9 @@
             filename = os.path.join(*self.index)
         else:
             filename = "."
-        log.Warn(_("Error '%s' processing %s") % (exc, filename))
+        log.Warn(_("Error '%s' processing %s") % (exc, filename),
+                 log.WarningCode.cannot_process,
+                 util.escape(filename))
 
     def log_prev_error(self, index):
         """Call function if no pending exception"""
@@ -405,8 +407,11 @@
             index_str = "."
         else:
             index_str = os.path.join(*index)
-        log.Warn(_("Skipping %s because of previous error") % index_str)
+        log.Warn(_("Skipping %s because of previous error") % index_str,
+                 log.WarningCode.process_skipped,
+                 util.escape(index_str))
 
 
 from duplicity import log
 from duplicity import robust
+from duplicity import util

=== modified file 'duplicity/log.py'
--- duplicity/log.py	2012-02-29 13:35:03 +0000
+++ duplicity/log.py	2012-03-21 03:26:21 +0000
@@ -137,6 +137,8 @@
     cannot_stat = 9
     cannot_read = 10
     no_sig_for_time = 11
+    cannot_process = 12
+    process_skipped = 13
 
 def Warn(s, code=WarningCode.generic, extra=None):
     """Shortcut used for warning messages (verbosity 2)"""


Follow ups