Fix typos in mergecode, notebly one missing space.
svn: r16556
This commit is contained in:
parent
a34d022cae
commit
ed85671df5
@ -210,8 +210,7 @@ class MergeEventQuery(object):
|
|||||||
|
|
||||||
self.phoenix.merge(self.titanic)
|
self.phoenix.merge(self.titanic)
|
||||||
|
|
||||||
trans = self.database.transaction_begin(_("Merge Event Objects"))
|
with self.database.transaction_begin(_("Merge Event Objects")) as trans:
|
||||||
with self.database.transaction_begin() as trans:
|
|
||||||
for person in self.database.iter_people():
|
for person in self.database.iter_people():
|
||||||
if person.has_handle_reference("Event", old_handle):
|
if person.has_handle_reference("Event", old_handle):
|
||||||
bri = person.birth_ref_index
|
bri = person.birth_ref_index
|
||||||
|
@ -297,7 +297,8 @@ class MergeFamilyQuery(object):
|
|||||||
self.database.commit_family(self.titanic, trans)
|
self.database.commit_family(self.titanic, trans)
|
||||||
self.database.commit_person(phoenix_person, trans)
|
self.database.commit_person(phoenix_person, trans)
|
||||||
else:
|
else:
|
||||||
query = MergePersonQuery(self.database, phoenix_person, titanic_person)
|
query = MergePersonQuery(self.database, phoenix_person,
|
||||||
|
titanic_person)
|
||||||
query.execute(family_merger=False, trans=trans)
|
query.execute(family_merger=False, trans=trans)
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
@ -309,34 +310,35 @@ class MergeFamilyQuery(object):
|
|||||||
|
|
||||||
with self.database.transaction_begin(_('Merge Family')) as trans:
|
with self.database.transaction_begin(_('Merge Family')) as trans:
|
||||||
|
|
||||||
phoenix_father = self.database.get_person_from_handle(self.phoenix_fh)
|
phoenix_father = self.database.get_person_from_handle(self.phoenix_fh)
|
||||||
titanic_father = self.database.get_person_from_handle(self.titanic_fh)
|
titanic_father = self.database.get_person_from_handle(self.titanic_fh)
|
||||||
self.merge_person(phoenix_father, titanic_father, 'father', trans)
|
self.merge_person(phoenix_father, titanic_father, 'father', trans)
|
||||||
|
|
||||||
phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh)
|
phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh)
|
||||||
titanic_mother = self.database.get_person_from_handle(self.titanic_mh)
|
titanic_mother = self.database.get_person_from_handle(self.titanic_mh)
|
||||||
self.phoenix = self.database.get_family_from_handle(new_handle)
|
self.phoenix = self.database.get_family_from_handle(new_handle)
|
||||||
self.titanic = self.database.get_family_from_handle(old_handle)
|
self.titanic = self.database.get_family_from_handle(old_handle)
|
||||||
self.merge_person(phoenix_mother, titanic_mother, 'mother', trans)
|
self.merge_person(phoenix_mother, titanic_mother, 'mother', trans)
|
||||||
|
|
||||||
phoenix_father = self.database.get_person_from_handle(self.phoenix_fh)
|
phoenix_father = self.database.get_person_from_handle(self.phoenix_fh)
|
||||||
phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh)
|
phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh)
|
||||||
self.phoenix = self.database.get_family_from_handle(new_handle)
|
self.phoenix = self.database.get_family_from_handle(new_handle)
|
||||||
self.titanic = self.database.get_family_from_handle(old_handle)
|
self.titanic = self.database.get_family_from_handle(old_handle)
|
||||||
self.phoenix.merge(self.titanic)
|
self.phoenix.merge(self.titanic)
|
||||||
for childref in self.titanic.get_child_ref_list():
|
for childref in self.titanic.get_child_ref_list():
|
||||||
child = self.database.get_person_from_handle(
|
child = self.database.get_person_from_handle(
|
||||||
childref.get_reference_handle())
|
childref.get_reference_handle())
|
||||||
if new_handle in child.parent_family_list:
|
if new_handle in child.parent_family_list:
|
||||||
child.remove_handle_references('Family', [old_handle])
|
child.remove_handle_references('Family', [old_handle])
|
||||||
else:
|
else:
|
||||||
child.replace_handle_reference('Family', old_handle, new_handle)
|
child.replace_handle_reference('Family', old_handle,
|
||||||
self.database.commit_person(child, trans)
|
new_handle)
|
||||||
if phoenix_father:
|
self.database.commit_person(child, trans)
|
||||||
phoenix_father.remove_family_handle(old_handle)
|
if phoenix_father:
|
||||||
self.database.commit_person(phoenix_father, trans)
|
phoenix_father.remove_family_handle(old_handle)
|
||||||
if phoenix_mother:
|
self.database.commit_person(phoenix_father, trans)
|
||||||
phoenix_mother.remove_family_handle(old_handle)
|
if phoenix_mother:
|
||||||
self.database.commit_person(phoenix_mother, trans)
|
phoenix_mother.remove_family_handle(old_handle)
|
||||||
self.database.remove_family(old_handle, trans)
|
self.database.commit_person(phoenix_mother, trans)
|
||||||
self.database.commit_family(self.phoenix, trans)
|
self.database.remove_family(old_handle, trans)
|
||||||
|
self.database.commit_family(self.phoenix, trans)
|
||||||
|
@ -362,6 +362,9 @@ class MergePersonQuery(object):
|
|||||||
return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1))
|
return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1))
|
||||||
|
|
||||||
def merge_families(self, main_family_handle, family, trans):
|
def merge_families(self, main_family_handle, family, trans):
|
||||||
|
"""
|
||||||
|
Merge content of family into the family with handle main_family_handle.
|
||||||
|
"""
|
||||||
new_handle = self.phoenix.get_handle() if self.phoenix else None
|
new_handle = self.phoenix.get_handle() if self.phoenix else None
|
||||||
family_handle = family.get_handle()
|
family_handle = family.get_handle()
|
||||||
main_family = self.database.get_family_from_handle(main_family_handle)
|
main_family = self.database.get_family_from_handle(main_family_handle)
|
||||||
@ -388,6 +391,9 @@ class MergePersonQuery(object):
|
|||||||
self.database.commit_family(main_family, trans)
|
self.database.commit_family(main_family, trans)
|
||||||
|
|
||||||
def execute(self, family_merger=True, trans=None):
|
def execute(self, family_merger=True, trans=None):
|
||||||
|
"""
|
||||||
|
Merges two persons into a single person.
|
||||||
|
"""
|
||||||
if trans is None:
|
if trans is None:
|
||||||
with self.database.transaction_begin(_('Merge Person')) as trans:
|
with self.database.transaction_begin(_('Merge Person')) as trans:
|
||||||
self.__execute(family_merger, trans)
|
self.__execute(family_merger, trans)
|
||||||
@ -396,14 +402,14 @@ class MergePersonQuery(object):
|
|||||||
|
|
||||||
def __execute(self, family_merger, trans):
|
def __execute(self, family_merger, trans):
|
||||||
"""
|
"""
|
||||||
Merges two persons into a single person.
|
Merges two persons into a single person; trans is compulsory.
|
||||||
"""
|
"""
|
||||||
new_handle = self.phoenix.get_handle()
|
new_handle = self.phoenix.get_handle()
|
||||||
old_handle = self.titanic.get_handle()
|
old_handle = self.titanic.get_handle()
|
||||||
|
|
||||||
self.phoenix.merge(self.titanic)
|
self.phoenix.merge(self.titanic)
|
||||||
|
|
||||||
for (p_dummy, person_handle) in self.database.find_backlink_handles(
|
for (dummy, person_handle) in self.database.find_backlink_handles(
|
||||||
old_handle, ['Person']):
|
old_handle, ['Person']):
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
assert person.has_handle_reference('Person', old_handle)
|
assert person.has_handle_reference('Person', old_handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user