"Caching helper calling self.evaluate(), returns a value or throws an exception."
check_depth(depth)
if not self.cached:
- self.cached_val = self.evaluate(depth+1)
+ self.cached_val = self.evaluate(depth=depth+1)
self.cached = True
if self.cached_val == None:
raise ConfigError("Unable to evaluate %r."%(self.name,))
if self.parent and not self.parent.value():
return False
if cl[0] in ['==','!=']:
- v = cl[1].evaluate(depth+1) == cl[2].evaluate(depth+1)
+ v = cl[1].evaluate(depth=depth+1) == cl[2].evaluate(depth=depth+1)
if cl[0] == '!=': v = not v
return v
- v1 = self.evaluate(cl[1], depth+1)
+ v1 = self.evaluate(cl=cl[1], depth=depth+1)
if cl[0] == 'NOT':
return not v1
if cl[0] == 'OR' and v1: return True
if cl[0] == 'AND' and not v1: return False
- return self.evaluate(cl[2], depth+1)
+ return self.evaluate(cl=cl[2], depth=depth+1)
def formula_string(self, formula):
"Create a string representation of a formula."
if formula[0] == 'AND':
op = self.operations[i]
# Check the guarding condition
if (not op.condition) or op.condition.value(depth+1):
- val.insert(0, op.expression.evaluate(depth+1))
+ val.insert(0, op.expression.evaluate(depth=depth+1))
if op.operation == 'SET':
return u''.join(val)
return None