diff --git a/ChangeLog b/ChangeLog index 8563bf8dc..22d45a8a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-12 Don Allingham + * src/DataViews/_RelationView.py: provide a waring if a broken + family is detected + * src/plugins/Check.py: Don't remove families with no parents + unless no children exist + 2006-09-12 Alex Roitman * src/plugins/TestcaseGenerator.py (fill_object): Use integer confidence level; (generate_date_tests): Remove invalid dates. diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index cd332070c..de5957579 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -723,20 +723,30 @@ class RelationshipView(PageView.PersonNavView): if dobj: if pname: - self.write_data(vbox, _('%(event_type)s: %(date)s in %(place)s') % - value, start_col, stop_col) + self.write_data( + vbox, _('%(event_type)s: %(date)s in %(place)s') % + value, start_col, stop_col) else: - self.write_data(vbox, _('%(event_type)s: %(date)s') % value, - start_col, stop_col) + self.write_data( + vbox, _('%(event_type)s: %(date)s') % value, + start_col, stop_col) elif pname: - self.write_data(vbox, _('%(event_type)s: %(place)s') % value, - start_col, stop_col) + self.write_data( + vbox, _('%(event_type)s: %(place)s') % value, + start_col, stop_col) else: - self.write_data(vbox, _('%(event_type)s:') % value, - start_col, stop_col) + self.write_data( + vbox, _('%(event_type)s:') % value, start_col, stop_col) def write_family(self, family_handle): family = self.dbstate.db.get_family_from_handle(family_handle) + if family == None: + from QuestionDialog import WarningDialog + WarningDialog( + _('Broken family detected'), + _('Please run the Check and Repair Database tool')) + return + father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() if self.dbstate.active.handle == father_handle: diff --git a/src/plugins/Check.py b/src/plugins/Check.py index d5706adea..cb767926e 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -514,24 +514,10 @@ class CheckIntegrity: father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() - if not father_handle and not mother_handle: + if not father_handle and not mother_handle and \ + len(family.get_child_ref_list()) == 0: self.empty_family.append(family_id) self.delete_empty_family(family_handle) - continue - elif not father_handle and len(family.get_child_ref_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_id) - continue - elif not mother_handle and len(family.get_child_ref_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_id) - continue def delete_empty_family(self,family_handle): for key in self.db.get_person_handles(sort_handles=False):