diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 0481339ee..e3f9ff030 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -2049,13 +2049,15 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def _order_by_tag_key(self, key): return glocale.sort_key(key) - def backup(self): + def backup(self, user=None): """ If you wish to support an optional backup routine, put it here. """ from gramps.plugins.export.exportxml import XmlWriter from gramps.cli.user import User - writer = XmlWriter(self, User(), strip_photos=0, compress=1) + if user is None: + user = User() + writer = XmlWriter(self, user, strip_photos=0, compress=1) timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now()) filename = os.path.join(self._directory, "backup-%s.gramps" % timestamp) writer.write(filename) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 773e640f3..8cb9104e2 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -761,7 +761,7 @@ class ViewManager(CLIManager): self.uistate.progress.show() self.uistate.push_message(self.dbstate, _("Autobackup...")) try: - self.dbstate.db.backup() + self.dbstate.db.backup(user=self.user) except DbException as msg: ErrorDialog(_("Error saving backup data"), msg, parent=self.uistate.window) diff --git a/gramps/plugins/database/bsddb_support/write.py b/gramps/plugins/database/bsddb_support/write.py index 5cc9237e6..626f4ce62 100644 --- a/gramps/plugins/database/bsddb_support/write.py +++ b/gramps/plugins/database/bsddb_support/write.py @@ -2471,7 +2471,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): """ return DbTxn - def backup(self): + def backup(self, user=None): """ Exports the database to a set of backup files. These files consist of the pickled database tables, one file for each table.