Check for missing father or mother in family rules

This commit is contained in:
Nick Hall 2016-04-06 23:17:10 +01:00
parent 9bd507d626
commit 0dd79314b1

View File

@ -31,25 +31,27 @@ in the class body, outside any method:
> apply = child_base > apply = child_base
""" """
def father_base(self,db,family): def father_base(self, db, family):
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
father = db.get_person_from_handle(father_handle) if father_handle:
if father: father = db.get_person_from_handle(father_handle)
return self.base_class.apply(self,db,father) if father:
else: return self.base_class.apply(self, db, father)
return False else:
return False
def mother_base(self,db,family): def mother_base(self, db, family):
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
mother = db.get_person_from_handle(mother_handle) if mother_handle:
if mother: mother = db.get_person_from_handle(mother_handle)
return self.base_class.apply(self,db,mother) if mother:
else: return self.base_class.apply(self, db, mother)
return False else:
return False
def child_base(self,db,family): def child_base(self, db, family):
for child_ref in family.get_child_ref_list(): for child_ref in family.get_child_ref_list():
child = db.get_person_from_handle(child_ref.ref) 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 True
return False return False