* src/plugins/Check.py: delete families that contain only a

single parent and no children


svn: r4453
This commit is contained in:
Don Allingham 2005-05-01 20:20:19 +00:00
parent 88c0938174
commit cbe87ed537
2 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2005-05-01 Don Allingham <don@gramps-project.org>
* src/plugins/Check.py: delete families that contain only a
single parent and no children
2005-05-01 Eero Tamminen <eerot@sf>
* src/dates/Date_fi.py: Fixed Display class + other changes.
Parser is waiting for Gramps DateParser.py update

View File

@ -68,7 +68,7 @@ def runTool(database,active_person,callback,parent=None):
while prev_total != total:
prev_total = total
checker.check_for_broken_family_links()
checker.check_parent_relationships()
checker.cleanup_empty_families(0)
@ -294,9 +294,27 @@ class CheckIntegrity:
def cleanup_empty_families(self,automatic):
for family_handle in self.db.get_family_handles():
family = self.db.get_family_from_handle(family_handle)
if not family.get_father_handle() and not family.get_mother_handle():
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if not father_handle and not mother_handle:
self.empty_family.append(family_handle)
self.delete_empty_family(family_handle)
continue
elif not father_handle and len(family.get_child_handle_list()) == 0:
person = self.db.get_person_from_handle(mother_handle)
person.remove_family_handle(family_handle)
self.db.commit_person(person,self.trans)
self.db.remove_family(family_handle,self.trans)
self.empty_family.append(family_handle)
continue
elif not mother_handle and len(family.get_child_handle_list()) == 0:
person = self.db.get_person_from_handle(father_handle)
person.remove_family_handle(family_handle)
self.db.commit_person(person,self.trans)
self.db.remove_family(family_handle,self.trans)
self.empty_family.append(family_handle)
continue
def delete_empty_family(self,family_handle):
for key in self.db.get_person_handles(sort_handles=False):