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 e2313aaba4
commit 13edf04889
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> 2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as * src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate. 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): def set_name_group_mapping(self,name,group):
if not self.readonly: if not self.readonly:
name = str(name) if self.UseTXN:
data = self.name_group.get(name,txn=self.txn) # Start transaction if needed
if not group and data: the_txn = self.env.txn_begin()
self.name_group.delete(name,txn=self.txn)
else: 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') self.emit('person-rebuild')
def get_surname_list(self): def get_surname_list(self):