From 832095aea53df9aa9f3927958975275d2feb2c0b Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 20 Jan 2007 16:55:08 +0000 Subject: [PATCH] * src/GrampsDb/_GrampsDbBase.py (transaction_commit): Remove backend-specific call. * src/GrampsDb/_GrampsBSDDB.py (transaction_commit): Move surname list build to work for any batch transaction. * src/GrampsDb/_GrampsInMemDB.py (transaction_commit): Add method. svn: r7939 --- gramps2/ChangeLog | 5 +++++ gramps2/src/GrampsDb/_GrampsBSDDB.py | 4 ++-- gramps2/src/GrampsDb/_GrampsDbBase.py | 8 +++----- gramps2/src/GrampsDb/_GrampsInMemDB.py | 5 +++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 096283051..a015d8064 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,9 @@ 2007-01-20 Alex Roitman + * src/GrampsDb/_GrampsDbBase.py (transaction_commit): Remove + backend-specific call. + * src/GrampsDb/_GrampsBSDDB.py (transaction_commit): Move surname + list build to work for any batch transaction. + * src/GrampsDb/_GrampsInMemDB.py (transaction_commit): Add method. * src/Utils.py (profile): Accept and pass additional arguments. * src/DataViews/_PersonView.py (delete_person_response): Busy cursor. diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index b876519d7..a3f6f1fba 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -1383,7 +1383,6 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): self.surnames.close() junk = db.DB(self.env) junk.remove(self.full_name,"surnames") - self.surnames = None self.reference_map_referenced_map.close() junk = db.DB(self.env) @@ -1439,7 +1438,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): self.reference_map.associate(self.reference_map_referenced_map, find_referenced_handle,open_flags) - self.build_surname_list() + # Only build surname list after surname index is surely back + self.build_surname_list() self.txn = None diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index bf6e5c81f..0f63e8f62 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -1370,12 +1370,10 @@ class GrampsDbBase(GrampsDBCallback): if self.__LOG_ALL: log.debug("%s: Transaction commit '%s'\n" % (self.__class__.__name__, str(msg))) - if self.readonly: - return - if not len(transaction): - if self.surnames != None: - self.build_surname_list() + + if not len(transaction) or self.readonly: return + transaction.set_description(msg) transaction.timestamp = time.time() self.undoindex += 1 diff --git a/gramps2/src/GrampsDb/_GrampsInMemDB.py b/gramps2/src/GrampsDb/_GrampsInMemDB.py index c174b4597..941909f0c 100644 --- a/gramps2/src/GrampsDb/_GrampsInMemDB.py +++ b/gramps2/src/GrampsDb/_GrampsInMemDB.py @@ -108,6 +108,11 @@ class GrampsInMemDB(GrampsDbBase): self.abort_possible = True self.undo_history_timestamp = time.time() + def transaction_commit(self,transaction,msg): + GrampsDbBase.transaction_commit(self,transaction,msg) + if transaction.batch: + self.build_surname_list() + def get_person_cursor(self): return GrampsInMemCursor(self.person_map)