8621: Recursion Filter error

This commit is contained in:
Doug Blank 2015-06-06 19:56:34 -04:00
parent 53a9cfc83f
commit ca3158a6ff

View File

@ -78,22 +78,26 @@ class IsDescendantFamilyOf(Rule):
return return
# Add self # Add self
self.matches.add(person.handle) expand = [person]
for family_handle in person.get_family_handle_list(): while expand:
family = self.db.get_family_from_handle(family_handle) person = expand.pop(0)
if family: if person is None:
# Add every child recursively continue
for child_ref in family.get_child_ref_list(): self.matches.add(person.handle)
if child_ref: for family_handle in person.get_family_handle_list():
self.add_matches(self.db.get_person_from_handle(child_ref.ref)) family = self.db.get_family_from_handle(family_handle)
if family:
# Add spouse # Add every child recursively
if person.handle == family.get_father_handle(): for child_ref in family.get_child_ref_list():
spouse_handle = family.get_mother_handle() if child_ref:
else: expand.append(self.db.get_person_from_handle(child_ref.ref))
spouse_handle = family.get_father_handle() # Add spouse
self.matches.add(spouse_handle) if person.handle == family.get_father_handle():
spouse_handle = family.get_mother_handle()
else:
spouse_handle = family.get_father_handle()
self.matches.add(spouse_handle)
def exclude(self): def exclude(self):
# This removes root person and his/her spouses from the matches set # This removes root person and his/her spouses from the matches set