2006-06-07 Alex Roitman <shura@gramps-project.org>
* src/plugins/Check.py (check_for_broken_family_links): Adapt to RelLib changes. svn: r6873
This commit is contained in:
parent
a60996dfc8
commit
4c16c41514
@ -1,3 +1,7 @@
|
|||||||
|
2006-06-07 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/Check.py (check_for_broken_family_links): Adapt to
|
||||||
|
RelLib changes.
|
||||||
|
|
||||||
2006-06-07 Don Allingham <don@gramps-project.org>
|
2006-06-07 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsDb/_ReadGedcom.py: fix child/parent relationships
|
* src/GrampsDb/_ReadGedcom.py: fix child/parent relationships
|
||||||
|
|
||||||
|
@ -284,7 +284,8 @@ class CheckIntegrity:
|
|||||||
self.broken_parent_links.append((father_handle,family_handle))
|
self.broken_parent_links.append((father_handle,family_handle))
|
||||||
father.add_family_handle(family_handle)
|
father.add_family_handle(family_handle)
|
||||||
self.db.commit_person(father,self.trans)
|
self.db.commit_person(father,self.trans)
|
||||||
if mother_handle and mother and family_handle not in mother.get_family_handle_list():
|
if mother_handle and mother \
|
||||||
|
and (family_handle not in mother.get_family_handle_list()):
|
||||||
# The referenced mother has no reference back to the family
|
# The referenced mother has no reference back to the family
|
||||||
self.broken_parent_links.append((mother_handle,family_handle))
|
self.broken_parent_links.append((mother_handle,family_handle))
|
||||||
mother.add_family_handle(family_handle)
|
mother.add_family_handle(family_handle)
|
||||||
@ -295,16 +296,15 @@ class CheckIntegrity:
|
|||||||
if child:
|
if child:
|
||||||
if family_handle == child.get_main_parents_family_handle():
|
if family_handle == child.get_main_parents_family_handle():
|
||||||
continue
|
continue
|
||||||
for family_type in child.get_parent_family_handle_list():
|
if family_handle not in \
|
||||||
if family_type[0] == family_handle:
|
child.get_parent_family_handle_list():
|
||||||
break
|
# The referenced child has no reference to the family
|
||||||
else:
|
|
||||||
# The referenced child has no reference back to the family
|
|
||||||
family.remove_child_ref(child_ref)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family,self.trans)
|
self.db.commit_family(family,self.trans)
|
||||||
self.broken_links.append((child_handle,family_handle))
|
self.broken_links.append((child_handle,family_handle))
|
||||||
else:
|
else:
|
||||||
# The person referenced by the child handle does not exist in the database
|
# The person referenced by the child handle
|
||||||
|
# does not exist in the database
|
||||||
family.remove_child_ref(child_ref)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family,self.trans)
|
self.db.commit_family(family,self.trans)
|
||||||
self.broken_links.append((child_handle,family_handle))
|
self.broken_links.append((child_handle,family_handle))
|
||||||
@ -313,18 +313,19 @@ class CheckIntegrity:
|
|||||||
# Check persons membership in referenced families
|
# Check persons membership in referenced families
|
||||||
for person_handle in self.db.get_person_handles():
|
for person_handle in self.db.get_person_handles():
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
for family_type in person.get_parent_family_handle_list():
|
for par_family_handle in person.get_parent_family_handle_list():
|
||||||
family = self.db.get_family_from_handle(family_type[0])
|
family = self.db.get_family_from_handle(par_family_handle)
|
||||||
if not family:
|
if not family:
|
||||||
person.remove_parent_family_handle(family_type[0])
|
person.remove_parent_family_handle(par_family_handle)
|
||||||
self.db.commit_person(person,self.trans)
|
self.db.commit_person(person,self.trans)
|
||||||
continue
|
continue
|
||||||
for child_handle in [x.ref for x in family.get_child_ref_list()]:
|
for child_handle in [child_ref.ref for child_ref
|
||||||
|
in family.get_child_ref_list()]:
|
||||||
if child_handle == person_handle:
|
if child_handle == person_handle:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# Person is not a child in the referenced parent family
|
# Person is not a child in the referenced parent family
|
||||||
person.remove_parent_family_handle(family_type[0])
|
person.remove_parent_family_handle(par_family_handle)
|
||||||
self.db.commit_person(person,self.trans)
|
self.db.commit_person(person,self.trans)
|
||||||
self.broken_links.append((person_handle,family_handle))
|
self.broken_links.append((person_handle,family_handle))
|
||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
|
Loading…
Reference in New Issue
Block a user