From 83f0a6c9e07c85f418f84f3216625a19ce834785 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 9 Sep 2003 01:48:30 +0000 Subject: [PATCH] * src/GenericFilter.py: handle the possibility of missing "inclusive" settings, assuming that it is 1 if not present. svn: r2108 --- src/GenericFilter.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 41b286980..391304bfc 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -207,9 +207,12 @@ class IsDescendantOf(Rule): def apply(self,db,p): self.orig = p - if int(self.list[1]): - first = 0 - else: + try: + if int(self.list[1]): + first = 0 + else: + first = 1 + except IndexError: first = 1 if not self.init: @@ -251,9 +254,12 @@ class IsDescendantOfFilterMatch(IsDescendantOf): def apply(self,db,p): self.orig = p - if int(self.list[1]): - first = 0 - else: + try: + if int(self.list[1]): + first = 0 + else: + first = 1 + except IndexError: first = 1 if not self.init: @@ -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 - if int(self.list[1]): - first = 0 - else: + 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 - if int(self.list[1]): - first = 0 - else: + 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])