diff --git a/ChangeLog b/ChangeLog index 09c382a9a..b31ef86af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-14 Alex Roitman + * src/GrampsDbUtils/_Backup.py (__do_restore): Minor optimization. + * src/GrampsDb/_GrampsDbBase.py (__get_from_handle): Pass txn. + 2007-06-14 Don Allingham * src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index bf88cc060..dba6e12af 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -748,9 +748,7 @@ class GrampsDbBase(GrampsDBCallback): return index def __get_from_handle(self, handle, class_type, data_map): - if not data_map: - return - data = data_map.get(str(handle)) + data = data_map.get(str(handle),txn=self.txn) if data: newobj = class_type() newobj.unserialize(data) diff --git a/src/GrampsDbUtils/_Backup.py b/src/GrampsDbUtils/_Backup.py index c1a4cf91a..df6a63e1c 100644 --- a/src/GrampsDbUtils/_Backup.py +++ b/src/GrampsDbUtils/_Backup.py @@ -127,11 +127,10 @@ def __do_restore(database): data = pickle.load(backup_table) if database.UseTXN: txn = database.env.txn_begin() - else: - txn = None - tbl.put(data[0], data[1], txn=txn) - if txn: + tbl.put(data[0], data[1], txn=txn) txn.commit() + else: + tbl.put(data[0], data[1], txn=None) except EOFError: if not database.UseTXN: tbl.sync()