Fix typos in mergecode, notebly one missing space.

svn: r16556
This commit is contained in:
Michiel Nauta 2011-02-03 18:35:27 +00:00
parent a34d022cae
commit ed85671df5
3 changed files with 41 additions and 34 deletions

View File

@ -210,8 +210,7 @@ class MergeEventQuery(object):
self.phoenix.merge(self.titanic)
trans = self.database.transaction_begin(_("Merge Event Objects"))
with self.database.transaction_begin() as trans:
with self.database.transaction_begin(_("Merge Event Objects")) as trans:
for person in self.database.iter_people():
if person.has_handle_reference("Event", old_handle):
bri = person.birth_ref_index

View File

@ -297,7 +297,8 @@ class MergeFamilyQuery(object):
self.database.commit_family(self.titanic, trans)
self.database.commit_person(phoenix_person, trans)
else:
query = MergePersonQuery(self.database, phoenix_person, titanic_person)
query = MergePersonQuery(self.database, phoenix_person,
titanic_person)
query.execute(family_merger=False, trans=trans)
def execute(self):
@ -330,7 +331,8 @@ class MergeFamilyQuery(object):
if new_handle in child.parent_family_list:
child.remove_handle_references('Family', [old_handle])
else:
child.replace_handle_reference('Family', old_handle, new_handle)
child.replace_handle_reference('Family', old_handle,
new_handle)
self.database.commit_person(child, trans)
if phoenix_father:
phoenix_father.remove_family_handle(old_handle)

View File

@ -362,6 +362,9 @@ class MergePersonQuery(object):
return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1))
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
family_handle = family.get_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)
def execute(self, family_merger=True, trans=None):
"""
Merges two persons into a single person.
"""
if trans is None:
with self.database.transaction_begin(_('Merge Person')) as trans:
self.__execute(family_merger, trans)
@ -396,14 +402,14 @@ class MergePersonQuery(object):
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()
old_handle = self.titanic.get_handle()
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']):
person = self.database.get_person_from_handle(person_handle)
assert person.has_handle_reference('Person', old_handle)