* src/plugins/Check.py: Add check for child handle in family, that does no longer exist in database

svn: r4238
This commit is contained in:
Martin Hawlisch 2005-03-26 10:53:27 +00:00
parent 0b5eeddbd1
commit 501596d92a
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2005-03-26 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/Check.py: Add check for child handle in family, that
does no longer exist in database
2005-03-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2005-03-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ScratchPad.py (ScratchPadWindow): moved content of pad to a * src/ScratchPad.py (ScratchPadWindow): moved content of pad to a
class attribute so that it is preserved when the pad is closed. class attribute so that it is preserved when the pad is closed.

View File

@ -112,6 +112,7 @@ class CheckIntegrity:
self.db.commit_person(mother,self.trans) self.db.commit_person(mother,self.trans)
for child_handle in family.get_child_handle_list(): for child_handle in family.get_child_handle_list():
child = self.db.get_person_from_handle(child_handle) child = self.db.get_person_from_handle(child_handle)
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(): for family_type in child.get_parent_family_handle_list():
@ -121,6 +122,11 @@ class CheckIntegrity:
family.remove_child_handle(child_handle) family.remove_child_handle(child_handle)
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:
family.remove_child_handle(child_handle)
self.db.commit_family(family,self.trans)
self.broken_links.append((child_handle,family_handle))
def cleanup_missing_photos(self,cl=0): def cleanup_missing_photos(self,cl=0):
missmedia_action = 0 missmedia_action = 0
@ -301,7 +307,10 @@ class CheckIntegrity:
for (person_handle,family_handle) in self.broken_links: for (person_handle,family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
family = self.db.get_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
if person:
cn = person.get_primary_name().get_name() cn = person.get_primary_name().get_name()
else:
cn = _("Non existing child")
f = self.db.get_person_from_handle(family.get_father_handle()) f = self.db.get_person_from_handle(family.get_father_handle())
m = self.db.get_person_from_handle(family.get_mother_handle()) m = self.db.get_person_from_handle(family.get_mother_handle())
if f and m: if f and m: