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:
@@ -29,6 +29,7 @@ Provide merge capabilities for events.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
|
||||
@@ -29,6 +29,7 @@ Provide merge capabilities for families.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
from gen.display.name import displayer as name_displayer
|
||||
import const
|
||||
@@ -308,7 +309,7 @@ class MergeFamilyQuery(object):
|
||||
new_handle = self.phoenix.get_handle()
|
||||
old_handle = self.titanic.get_handle()
|
||||
|
||||
with self.database.transaction_begin(_('Merge Family')) as trans:
|
||||
with DbTxn(_('Merge Family'), self.database) as trans:
|
||||
|
||||
phoenix_father = self.database.get_person_from_handle(self.phoenix_fh)
|
||||
titanic_father = self.database.get_person_from_handle(self.titanic_fh)
|
||||
|
||||
@@ -29,6 +29,7 @@ Provide merge capabilities for media objects.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -184,7 +185,7 @@ class MergeMediaQuery(object):
|
||||
|
||||
self.phoenix.merge(self.titanic)
|
||||
|
||||
with self.database.transaction_begin(_("Merge Media Objects")) as trans:
|
||||
with DbTxn(_("Merge Media Objects"), self.database) as trans:
|
||||
for person in self.database.iter_people():
|
||||
if person.has_media_reference(old_handle):
|
||||
person.replace_media_references(old_handle, new_handle)
|
||||
|
||||
@@ -29,6 +29,7 @@ Provide merge capabilities for notes.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -196,7 +197,7 @@ class MergeNoteQuery(object):
|
||||
new_handle = self.phoenix.get_handle()
|
||||
old_handle = self.titanic.get_handle()
|
||||
self.phoenix.merge(self.titanic)
|
||||
with self.database.transaction_begin(_("Merge Notes")) as trans:
|
||||
with DbTxn(_("Merge Notes"), self.database) as trans:
|
||||
|
||||
for person in self.database.iter_people():
|
||||
if person.has_note_reference(old_handle):
|
||||
|
||||
@@ -38,6 +38,7 @@ import pango
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
from gen.plug.report import utils as ReportUtils
|
||||
from gen.display.name import displayer as name_displayer
|
||||
@@ -406,7 +407,7 @@ class MergePersonQuery(object):
|
||||
Merges two persons into a single person.
|
||||
"""
|
||||
if trans is None:
|
||||
with self.database.transaction_begin(_('Merge Person')) as trans:
|
||||
with DbTxn(_('Merge Person'), self.database) as trans:
|
||||
self.__execute(family_merger, trans)
|
||||
else:
|
||||
self.__execute(family_merger, trans)
|
||||
|
||||
@@ -37,6 +37,7 @@ import gtk
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -210,7 +211,7 @@ class MergePlaceQuery(object):
|
||||
|
||||
self.phoenix.merge(self.titanic)
|
||||
|
||||
with self.database.transaction_begin(_("Merge Places")) as trans:
|
||||
with DbTxn(_("Merge Places"), self.database) as trans:
|
||||
for person in self.database.iter_people():
|
||||
if person.has_handle_reference('Place', old_handle):
|
||||
person.replace_handle_reference('Place', old_handle,
|
||||
|
||||
@@ -29,6 +29,7 @@ Provide merge capabilities for repositories.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -171,7 +172,7 @@ class MergeRepoQuery(object):
|
||||
|
||||
self.phoenix.merge(self.titanic)
|
||||
|
||||
with self.database.transaction_begin(_("Merge Repositories")) as trans:
|
||||
with DbTxn(_("Merge Repositories"), self.database) as trans:
|
||||
for source in self.database.iter_sources():
|
||||
if source.has_repo_reference(old_handle):
|
||||
source.replace_repo_references(old_handle, new_handle)
|
||||
|
||||
@@ -30,6 +30,7 @@ Provide merge capabilities for sources.
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db import DbTxn
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -197,7 +198,7 @@ class MergeSourceQuery(object):
|
||||
|
||||
self.phoenix.merge(self.titanic)
|
||||
|
||||
with self.database.transaction_begin(_("Merge Source")) as trans:
|
||||
with DbTxn(_("Merge Source"), self.database) as trans:
|
||||
for person in self.database.iter_people():
|
||||
if person.has_source_reference(old_handle):
|
||||
person.replace_source_references(old_handle, new_handle)
|
||||
|
||||
Reference in New Issue
Block a user