From 0dd79314b1a61f44f740f5743b4fbfd5968a3140 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Wed, 6 Apr 2016 23:17:10 +0100 Subject: [PATCH] Check for missing father or mother in family rules --- .../gen/filters/rules/family/_memberbase.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/gramps/gen/filters/rules/family/_memberbase.py b/gramps/gen/filters/rules/family/_memberbase.py index 983e67647..db8435a84 100644 --- a/gramps/gen/filters/rules/family/_memberbase.py +++ b/gramps/gen/filters/rules/family/_memberbase.py @@ -31,25 +31,27 @@ in the class body, outside any method: > apply = child_base """ -def father_base(self,db,family): +def father_base(self, db, family): father_handle = family.get_father_handle() - father = db.get_person_from_handle(father_handle) - if father: - return self.base_class.apply(self,db,father) - else: - return False + if father_handle: + father = db.get_person_from_handle(father_handle) + if father: + return self.base_class.apply(self, db, father) + else: + return False -def mother_base(self,db,family): +def mother_base(self, db, family): mother_handle = family.get_mother_handle() - mother = db.get_person_from_handle(mother_handle) - if mother: - return self.base_class.apply(self,db,mother) - else: - return False + if mother_handle: + mother = db.get_person_from_handle(mother_handle) + if mother: + return self.base_class.apply(self, db, mother) + else: + return False -def child_base(self,db,family): +def child_base(self, db, family): for child_ref in family.get_child_ref_list(): child = db.get_person_from_handle(child_ref.ref) - if self.base_class.apply(self,db,child): + if self.base_class.apply(self, db, child): return True return False