]> mj.ucw.cz Git - moe.git/commitdiff
Fixed minor bug in conf condition eval
authorTomas Gavenciak <gavento@matfyz.cz>
Sat, 29 May 2010 15:57:26 +0000 (11:57 -0400)
committerTomas Gavenciak <gavento@matfyz.cz>
Sat, 29 May 2010 15:57:26 +0000 (11:57 -0400)
Fixed mismatch of params of eval(cl, depth)

t/moe/conf.py

index 538f9891bdd603895b5b56c644798f784a21b0cb..9d697af68673f46effdab3ca96df7348907a3d6e 100644 (file)
@@ -103,7 +103,7 @@ class ConfigElem(object):
     "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,))
@@ -157,15 +157,15 @@ class ConfigCondition(ConfigElem):
     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':
@@ -260,7 +260,7 @@ class ConfigVar(ConfigElem):
       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