2006-08-01 Alex Roitman <shura@gramps-project.org>

* src/GrampsDb/_GrampsBSDDB.py (set_name_group_mapping): Use
	transaction.



svn: r7108
This commit is contained in:
Alex Roitman 2006-08-01 16:24:27 +00:00
parent 543abbf8d5
commit d05a9bdc86
2 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2006-08-01 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (set_name_group_mapping): Use
transaction.
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.

View File

@ -978,12 +978,21 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
def set_name_group_mapping(self,name,group):
if not self.readonly:
name = str(name)
data = self.name_group.get(name,txn=self.txn)
if not group and data:
self.name_group.delete(name,txn=self.txn)
if self.UseTXN:
# Start transaction if needed
the_txn = self.env.txn_begin()
else:
self.name_group.put(name,group,txn=self.txn)
the_txn = None
name = str(name)
data = self.name_group.get(name,txn=the_txn)
if not group and data:
self.name_group.delete(name,txn=the_txn)
else:
self.name_group.put(name,group,txn=the_txn)
if self.UseTXN:
the_txn.commit()
else:
self.name_group.sync()
self.emit('person-rebuild')
def get_surname_list(self):