Improve 'or' logic
'or' would fail trying to parse 'succeeded'
@@ -410,6 +410,9 @@ class EvaluationRule(object):
Returns:
Bool: True if a partial evaluation succeeded
"""
+ if 'succeeded' in rule: # Rule has already succeeded, test not needed
+ return True
+
if rule[0] == 'equal':
if self._get_field_value(rule[1], msg) != rule[2]:
return False
@@ -440,10 +443,9 @@ class EvaluationRule(object):
if rule[0] == 'or':
for i in rule[1:]:
if self._partial_evaluate(i, msg):
- rule.append('succeeded')
- return True
+ break
+ else:
return False
-
rule.append('succeeded')
return True
