* src/GenericFilter.py: handle the possibility of missing

"inclusive" settings, assuming that it is 1 if not present.


svn: r2108
This commit is contained in:
Don Allingham 2003-09-09 01:48:30 +00:00
parent a8f5de5849
commit 718a68ea33

View File

@ -207,10 +207,13 @@ class IsDescendantOf(Rule):
def apply(self,db,p):
self.orig = p
try:
if int(self.list[1]):
first = 0
else:
first = 1
except IndexError:
first = 1
if not self.init:
self.init = 1
@ -251,10 +254,13 @@ class IsDescendantOfFilterMatch(IsDescendantOf):
def apply(self,db,p):
self.orig = p
try:
if int(self.list[1]):
first = 0
else:
first = 1
except IndexError:
first = 1
if not self.init:
self.init = 1
@ -464,11 +470,16 @@ class IsAncestorOf(Rule):
return _("Ancestral filters")
def apply(self,db,p):
"""Assume that if 'Inclusive' not defined, assume inclusive"""
self.orig = p
try:
if int(self.list[1]):
first = 0
else:
first = 1
except IndexError:
first = 1
if not self.init:
self.init = 1
root = db.getPerson(self.list[0])
@ -476,8 +487,6 @@ class IsAncestorOf(Rule):
return self.map.has_key(p.getId())
def init_ancestor_list(self,p,first):
# if self.map.has_key(p.getId()) == 1:
# loop_error(self.orig,p)
if not first:
self.map[p.getId()] = 1
@ -517,10 +526,14 @@ class IsAncestorOfFilterMatch(IsAncestorOf):
def apply(self,db,p):
self.orig = p
try:
if int(self.list[1]):
first = 0
else:
first = 1
except IndexError:
first = 1
if not self.init:
self.init = 1
filter = MatchesFilter(self.list[0])