Add ability to use Rule in a boolean operation: "if Rule()" will be equivalent to "if Rule.apply()"

svn: r12845
This commit is contained in:
Gerald Britton 2009-07-28 18:18:56 +00:00
parent a62b15353e
commit 7be4c7a2bf

View File

@ -69,9 +69,8 @@ class Rule(object):
def apply(self, db, person):
return True
#def __nonzero__(self, db, person):
# return self.apply(db, person)
__nonzero__ = apply
def display_values(self):
v = ( '%s="%s"' % ((_(self.labels[ix]),)*2)
for ix in xrange(len(self.list)) if self.list[ix] )