4198: Person view does not remove a row correctly when two people are merged.
This patch improves on the context changes: * avoid use of transaction_xx methods * force an abort in case of unclean transaction Backward compatibility is broken to achieve this. svn: r16680
This commit is contained in:
@@ -37,7 +37,7 @@ import gtk
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import find_surname_name
|
||||
from gen.db import find_surname_name, DbTxn
|
||||
import const
|
||||
from gui.utils import ProgressMeter
|
||||
import GrampsDisplay
|
||||
@@ -231,8 +231,8 @@ class ChangeNames(tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
GrampsDisplay.help(WIKI_HELP_PAGE , WIKI_HELP_SEC)
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
with self.db.transaction_begin(_("Capitalization changes"),batch=True
|
||||
) as self.trans:
|
||||
with DbTxn(_("Capitalization changes"), self.db, batch=True
|
||||
) as self.trans:
|
||||
self.db.disable_signals()
|
||||
changelist = set(self.model.get_value(node,1)
|
||||
for node in self.iter_list
|
||||
|
@@ -42,6 +42,7 @@ import locale
|
||||
import ManagedWindow
|
||||
import AutoComp
|
||||
from gen.lib import EventType
|
||||
from gen.db import DbTxn
|
||||
from QuestionDialog import OkDialog
|
||||
from gui.plug import tool
|
||||
from glade import Glade
|
||||
@@ -110,8 +111,7 @@ class ChangeTypes(tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
|
||||
modified = 0
|
||||
|
||||
with self.db.transaction_begin(_('Change types'), batch=True
|
||||
) as self.trans:
|
||||
with DbTxn(_('Change types'), self.db, batch=True) as self.trans:
|
||||
self.db.disable_signals()
|
||||
if not cli:
|
||||
progress = ProgressMeter(_('Analyzing Events'),'')
|
||||
|
@@ -59,6 +59,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import ManagedWindow
|
||||
@@ -174,8 +175,7 @@ class Check(tool.BatchTool):
|
||||
if self.db.__class__.__name__ == 'DbBsddb':
|
||||
low_level(self.db)
|
||||
|
||||
with self.db.transaction_begin(_("Check Integrity"), batch=True
|
||||
) as trans:
|
||||
with DbTxn(_("Check Integrity"), self.db, batch=True) as trans:
|
||||
self.db.disable_signals()
|
||||
checker = CheckIntegrity(dbstate, uistate, trans)
|
||||
checker.fix_encoding()
|
||||
|
@@ -44,6 +44,7 @@ from gen.ggettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
from gui.plug import tool
|
||||
from gui.utils import ProgressMeter
|
||||
from QuestionDialog import QuestionDialog
|
||||
@@ -155,8 +156,7 @@ class DateParserDisplayTest(tool.Tool):
|
||||
# (4,7,1789,False,5,88,1876,False),"Text comment")
|
||||
#dates.append( d)
|
||||
|
||||
with self.db.transaction_begin(_("Date Test Plugin"),batch=True
|
||||
) as trans:
|
||||
with DbTxn(_("Date Test Plugin"), self.db, batch=True) as trans:
|
||||
self.db.disable_signals()
|
||||
self.progress.set_pass(_('Generating dates'),
|
||||
len(dates))
|
||||
|
@@ -45,6 +45,7 @@ from gen.ggettext import ngettext
|
||||
#-------------------------------------------------------------------------
|
||||
import ManagedWindow
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
import Utils
|
||||
|
||||
from gui.plug import tool
|
||||
@@ -78,8 +79,7 @@ class EventNames(tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Perform the actual extraction of information.
|
||||
"""
|
||||
with self.db.transaction_begin(_("Event name changes"), batch=True
|
||||
) as trans:
|
||||
with DbTxn(_("Event name changes"), self.db, batch=True) as trans:
|
||||
self.db.disable_signals()
|
||||
self.change = False
|
||||
counter = 0
|
||||
|
@@ -46,6 +46,7 @@ import gobject
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
import ManagedWindow
|
||||
import GrampsDisplay
|
||||
|
||||
@@ -591,8 +592,7 @@ class ExtractCity(tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
GrampsDisplay.help()
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
with self.db.transaction_begin(_("Extract Place data"), batch=True
|
||||
) as self.trans:
|
||||
with DbTxn(_("Extract Place data"), self.db, batch=True) as self.trans:
|
||||
self.db.disable_signals()
|
||||
changelist = [node for node in self.iter_list
|
||||
if self.model.get_value(node, 0)]
|
||||
|
@@ -53,6 +53,7 @@ import GrampsDisplay
|
||||
import Assistant
|
||||
import Errors
|
||||
from gen.lib import MediaObject
|
||||
from gen.db import DbTxn
|
||||
from gen.updatecallback import UpdateCallback
|
||||
from gui.plug import tool
|
||||
from Utils import media_path_full, relative_path, media_path
|
||||
@@ -359,7 +360,7 @@ class BatchOp(UpdateCallback):
|
||||
Should not be overridden without good reasons.
|
||||
"""
|
||||
self.db.disable_signals()
|
||||
with self.db.transaction_begin("", batch=True) as self.trans:
|
||||
with DbTxn("", self.db, batch=True) as self.trans:
|
||||
success = self._run()
|
||||
trans.set_description(self.title)
|
||||
self.db.enable_signals()
|
||||
|
@@ -56,6 +56,7 @@ import GrampsDisplay
|
||||
from gen.ggettext import sgettext as _
|
||||
from glade import Glade
|
||||
from gen.lib import Tag
|
||||
from gen.db import DbTxn
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -242,7 +243,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
|
||||
tag_name = self.tagcombo.get_active_text()
|
||||
|
||||
# start the db transaction
|
||||
with self.db.transaction_begin("Tag not related") as transaction:
|
||||
with DbTxn("Tag not related", self.db) as transaction:
|
||||
|
||||
tag = self.db.get_tag_from_name(tag_name)
|
||||
if not tag:
|
||||
|
@@ -51,6 +51,7 @@ from QuestionDialog import OkDialog
|
||||
import ManagedWindow
|
||||
import GrampsDisplay
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
from glade import Glade
|
||||
|
||||
@@ -481,8 +482,8 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
GrampsDisplay.help(webpage=WIKI_HELP_PAGE, section=WIKI_HELP_SEC)
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
with self.db.transaction_begin(_("Extract information from names"),
|
||||
batch=True) as trans:
|
||||
with DbTxn(_("Extract information from names"), self.db, batch=True
|
||||
) as trans:
|
||||
self.db.disable_signals()
|
||||
|
||||
for key, data in self.handle_to_action.items():
|
||||
|
@@ -54,6 +54,7 @@ import gobject
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
import Errors
|
||||
import ManagedWindow
|
||||
from DateHandler import displayer as _dd
|
||||
@@ -279,8 +280,7 @@ class RemoveUnused(tool.Tool, ManagedWindow.ManagedWindow, UpdateCallback):
|
||||
self.reset()
|
||||
|
||||
def do_remove(self, obj):
|
||||
with self.db.transaction_begin(_("Remove unused objects"),
|
||||
batch=False) as trans:
|
||||
with DbTxn(_("Remove unused objects"), self.db, batch=False) as trans:
|
||||
self.db.disable_signals()
|
||||
|
||||
for row_num in range(len(self.real_model)-1, -1, -1):
|
||||
|
@@ -42,6 +42,7 @@ from gen.ggettext import gettext as _
|
||||
#------------------------------------------------------------------------
|
||||
from gui.utils import ProgressMeter
|
||||
import gen.lib
|
||||
from gen.lib import DbTxn
|
||||
from gui.plug import tool
|
||||
|
||||
_findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
||||
@@ -67,8 +68,7 @@ class ReorderIds(tool.BatchTool):
|
||||
else:
|
||||
print "Reordering Gramps IDs..."
|
||||
|
||||
with db.transaction_begin(_("Reorder Gramps IDs"), batch=True
|
||||
) as self.trans:
|
||||
with DbTxn(_("Reorder Gramps IDs"), db, batch=True) as self.trans:
|
||||
db.disable_signals()
|
||||
|
||||
if uistate:
|
||||
|
@@ -37,6 +37,7 @@ from gen.ggettext import gettext as _
|
||||
#-------------------------------------------------------------------------
|
||||
import Sort
|
||||
|
||||
from gen.db import DbTxn
|
||||
from gui.plug import MenuToolOptions, PluginWindows
|
||||
from gen.plug.report import utils as ReportUtils
|
||||
from gen.plug.menu import FilterOption, PersonOption, \
|
||||
@@ -95,8 +96,7 @@ class SortEvents(PluginWindows.ToolManagedWindowBatch):
|
||||
self.sort_name = sort_functions[sort_func_num][0]
|
||||
self.sort_func = sort_functions[sort_func_num][1]
|
||||
self.sort = Sort.Sort(self.db)
|
||||
with self.db.transaction_begin(_("Sort event changes"), batch=True
|
||||
) as trans:
|
||||
with DbTxn(_("Sort event changes"), self.db, batch=True) as trans:
|
||||
self.db.disable_signals()
|
||||
family_handles = self.sort_person_events(trans)
|
||||
if len(family_handles) > 0:
|
||||
|
Reference in New Issue
Block a user