* src/plugins/ChangeTypes.py: Use transaction for commits.

svn: r3161
This commit is contained in:
Alex Roitman 2004-05-13 04:21:27 +00:00
parent 0fe415ecec
commit a22fd16986
2 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,7 @@
* src/plugins/Check.py: Use transaction for commits. * src/plugins/Check.py: Use transaction for commits.
* src/plugins/PatchNames.py: Use transaction for commits. * src/plugins/PatchNames.py: Use transaction for commits.
* src/plugins/ChangeTypes.py: Use transaction for commits.
2004-05-11 Don Allingham <donaldallingham@users.sourceforge.net> 2004-05-11 Don Allingham <donaldallingham@users.sourceforge.net>
* src/GrampsCfg.py: remove unused options * src/GrampsCfg.py: remove unused options

View File

@ -40,8 +40,13 @@ import AutoComp
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def runTool(database,person,callback,parent=None): def runTool(database,person,callback,parent=None):
try: try:
ChangeTypes(database,person,parent) trans = database.start_transaction()
ChangeTypes(database,person,parent,trans)
database.add_transaction(trans)
except: except:
database.add_transaction(trans)
database.undo()
import DisplayTrace import DisplayTrace
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
@ -51,9 +56,10 @@ def runTool(database,person,callback,parent=None):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class ChangeTypes: class ChangeTypes:
def __init__(self,db,person,parent): def __init__(self,db,person,parent,trans):
self.person = person self.person = person
self.db = db self.db = db
self.trans = trans
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = "%s/%s" % (base,"changetype.glade") glade_file = "%s/%s" % (base,"changetype.glade")
@ -87,7 +93,7 @@ class ChangeTypes:
if event.get_name() == original: if event.get_name() == original:
event.set_name(new) event.set_name(new)
modified = modified + 1 modified = modified + 1
self.db.commit_event(event) self.db.commit_event(event,self.trans)
if modified == 1: if modified == 1:
msg = _("1 event record was modified") msg = _("1 event record was modified")