From 7be4c7a2bf96a7e70869027bb930ccfadddb9736 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Tue, 28 Jul 2009 18:18:56 +0000 Subject: [PATCH] Add ability to use Rule in a boolean operation: "if Rule()" will be equivalent to "if Rule.apply()" svn: r12845 --- src/Filters/Rules/_Rule.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Filters/Rules/_Rule.py b/src/Filters/Rules/_Rule.py index f09bcc981..34aee9c99 100644 --- a/src/Filters/Rules/_Rule.py +++ b/src/Filters/Rules/_Rule.py @@ -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] )