From 40cec6825e0be367ffddb374047ff163d3388643 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Sat, 26 Mar 2005 10:53:27 +0000 Subject: [PATCH] * src/plugins/Check.py: Add check for child handle in family, that does no longer exist in database svn: r4238 --- ChangeLog | 4 ++++ src/plugins/Check.py | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0d2ebd91..08e2426dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-03-26 Martin Hawlisch + * src/plugins/Check.py: Add check for child handle in family, that + does no longer exist in database + 2005-03-25 Richard Taylor * src/ScratchPad.py (ScratchPadWindow): moved content of pad to a class attribute so that it is preserved when the pad is closed. diff --git a/src/plugins/Check.py b/src/plugins/Check.py index ff7e69196..9855b8246 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -112,15 +112,21 @@ class CheckIntegrity: self.db.commit_person(mother,self.trans) for child_handle in family.get_child_handle_list(): child = self.db.get_person_from_handle(child_handle) - if family_handle == child.get_main_parents_family_handle(): - continue - for family_type in child.get_parent_family_handle_list(): - if family_type[0] == family_handle: - break + if child: + if family_handle == child.get_main_parents_family_handle(): + continue + for family_type in child.get_parent_family_handle_list(): + if family_type[0] == family_handle: + break + else: + family.remove_child_handle(child_handle) + self.db.commit_family(family,self.trans) + 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): missmedia_action = 0 @@ -301,7 +307,10 @@ class CheckIntegrity: for (person_handle,family_handle) in self.broken_links: person = self.db.get_person_from_handle(person_handle) family = self.db.get_family_from_handle(family_handle) - cn = person.get_primary_name().get_name() + if person: + cn = person.get_primary_name().get_name() + else: + cn = _("Non existing child") f = self.db.get_person_from_handle(family.get_father_handle()) m = self.db.get_person_from_handle(family.get_mother_handle()) if f and m: