diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 59410209671..674a9aa9216 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -626,11 +626,11 @@ def load(self, directory, callback=None, mode=DBMODE_W, self._set_save_path(directory) - if self._directory: + if self._directory and self._directory != ":memory:": self.undolog = os.path.join(self._directory, DBUNDOFN) else: self.undolog = None - self.undodb = DbGenericUndo(self, self.undolog) + self.undodb = self._create_undo_manager() self.undodb.open() # Other items to load @@ -665,6 +665,12 @@ def load(self, directory, callback=None, mode=DBMODE_W, self.close() raise DbUpgradeRequiredError(dbversion, self.VERSION[0]) + def _create_undo_manager(self): + """ + Create the undo manager. + """ + return DbGenericUndo(self, self.undolog) + def _close(self): """ Close database backend. diff --git a/gramps/gen/db/undoredo.py b/gramps/gen/db/undoredo.py index a8bff6784c8..51fa9dc2d38 100644 --- a/gramps/gen/db/undoredo.py +++ b/gramps/gen/db/undoredo.py @@ -125,6 +125,13 @@ def commit(self, txn, msg): txn.set_description(msg) txn.timestamp = time.time() self.undoq.append(txn) + self._after_commit(txn) + + def _after_commit(self, transaction): + """ + Post-transaction commit processing. + """ + pass def undo(self, update_history=True): """