From 913a276b65f9d35080bbbe926be63b077d8be396 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 12 May 2002 14:36:50 +0000 Subject: [PATCH] Avoid infinite recursion in search for spouses of descendents svn: r986 --- gramps/src/GenericFilter.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/gramps/src/GenericFilter.py b/gramps/src/GenericFilter.py index 5d8216dfe..ee377d29d 100644 --- a/gramps/src/GenericFilter.py +++ b/gramps/src/GenericFilter.py @@ -198,27 +198,26 @@ class IsDescendantFamilyOf(Rule): return "Is a descendant family member of" def apply(self,p): - return self.search(p) + return self.search(p,1) - def search(self,p): + def search(self,p,val): if p.getId() == self.list[0]: return 1 for (f,r1,r2) in p.getParentList(): for p1 in [f.getMother(),f.getFather()]: if p1: - if self.search(p1): + if self.search(p1,0): return 1 - for fm in p.getFamilyList(): - if p == fm.getFather(): - s = fm.getMother() - else: - s = fm.getFather() - if s: - for (f,r1,r2) in s.getParentList(): - for p1 in [f.getMother(),f.getFather()]: - if p1: - if self.search(p1): - return 1 + if val: + for fm in p.getFamilyList(): + if p == fm.getFather(): + s = fm.getMother() + else: + s = fm.getFather() + if s: + if self.search(s,0): + return 1 + return 0 #-------------------------------------------------------------------------