Tweaks
svn: r12775
This commit is contained in:
@ -69,9 +69,12 @@ class Rule(object):
|
||||
def apply(self, db, person):
|
||||
return True
|
||||
|
||||
#def __nonzero__(self, db, person):
|
||||
# return self.apply(db, person)
|
||||
|
||||
def display_values(self):
|
||||
v = [ '%s="%s"' % (_(self.labels[ix]),_(self.list[ix]))
|
||||
for ix in range(0,len(self.list)) if self.list[ix] ]
|
||||
v = ( '%s="%s"' % ((_(self.labels[ix]),)*2)
|
||||
for ix in xrange(len(self.list)) if self.list[ix] )
|
||||
|
||||
return ';'.join(v)
|
||||
|
||||
|
@ -184,13 +184,13 @@ class GenericFilter(object):
|
||||
return test
|
||||
|
||||
def one_test(self, db, person):
|
||||
count = 0
|
||||
found_one = False
|
||||
for rule in self.flist:
|
||||
if rule.apply(db, person):
|
||||
if count:
|
||||
return False
|
||||
count += 1
|
||||
return count == 1
|
||||
if found_one:
|
||||
return False # There can be only one!
|
||||
found_one = True
|
||||
return found_one
|
||||
|
||||
def or_test(self, db, person):
|
||||
return any(rule.apply(db, person) for rule in self.flist)
|
||||
|
Reference in New Issue
Block a user