Avoid infinite recursion in search for spouses of descendents
svn: r986
This commit is contained in:
parent
fe9ab88ef0
commit
913a276b65
@ -198,27 +198,26 @@ class IsDescendantFamilyOf(Rule):
|
|||||||
return "Is a descendant family member of"
|
return "Is a descendant family member of"
|
||||||
|
|
||||||
def apply(self,p):
|
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]:
|
if p.getId() == self.list[0]:
|
||||||
return 1
|
return 1
|
||||||
for (f,r1,r2) in p.getParentList():
|
for (f,r1,r2) in p.getParentList():
|
||||||
for p1 in [f.getMother(),f.getFather()]:
|
for p1 in [f.getMother(),f.getFather()]:
|
||||||
if p1:
|
if p1:
|
||||||
if self.search(p1):
|
if self.search(p1,0):
|
||||||
return 1
|
return 1
|
||||||
for fm in p.getFamilyList():
|
if val:
|
||||||
if p == fm.getFather():
|
for fm in p.getFamilyList():
|
||||||
s = fm.getMother()
|
if p == fm.getFather():
|
||||||
else:
|
s = fm.getMother()
|
||||||
s = fm.getFather()
|
else:
|
||||||
if s:
|
s = fm.getFather()
|
||||||
for (f,r1,r2) in s.getParentList():
|
if s:
|
||||||
for p1 in [f.getMother(),f.getFather()]:
|
if self.search(s,0):
|
||||||
if p1:
|
return 1
|
||||||
if self.search(p1):
|
|
||||||
return 1
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user