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