From 4f3839e0d08d9728c5296edc9569a1920f135f35 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 13 May 2004 04:21:27 +0000 Subject: [PATCH] * src/plugins/ChangeTypes.py: Use transaction for commits. svn: r3161 --- ChangeLog | 1 + src/plugins/ChangeTypes.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a90486f22..1515af53c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ * src/plugins/Check.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 * src/GrampsCfg.py: remove unused options diff --git a/src/plugins/ChangeTypes.py b/src/plugins/ChangeTypes.py index 94c611d37..5b117c555 100644 --- a/src/plugins/ChangeTypes.py +++ b/src/plugins/ChangeTypes.py @@ -40,8 +40,13 @@ import AutoComp #------------------------------------------------------------------------- def runTool(database,person,callback,parent=None): try: - ChangeTypes(database,person,parent) + trans = database.start_transaction() + ChangeTypes(database,person,parent,trans) + database.add_transaction(trans) except: + database.add_transaction(trans) + database.undo() + import DisplayTrace DisplayTrace.DisplayTrace() @@ -51,9 +56,10 @@ def runTool(database,person,callback,parent=None): # #------------------------------------------------------------------------- class ChangeTypes: - def __init__(self,db,person,parent): + def __init__(self,db,person,parent,trans): self.person = person self.db = db + self.trans = trans base = os.path.dirname(__file__) glade_file = "%s/%s" % (base,"changetype.glade") @@ -87,7 +93,7 @@ class ChangeTypes: if event.get_name() == original: event.set_name(new) modified = modified + 1 - self.db.commit_event(event) + self.db.commit_event(event,self.trans) if modified == 1: msg = _("1 event record was modified")