From 832c7a7862d8431d7c25a2638f65e177a0b7a99c Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 29 May 2010 13:26:47 -0400 Subject: [PATCH] Now moe module, update ConfigError, minor fix --- t/moe/conf.py | 5 +++-- t/moe/confparser.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/t/moe/conf.py b/t/moe/conf.py index 1564068..f561b75 100644 --- a/t/moe/conf.py +++ b/t/moe/conf.py @@ -26,6 +26,7 @@ TODO: Test conditions and unicode import types, itertools, re, bisect import logging as log +from moe import MoeError "Allowed depth of recursion - includes ALL recursive calls, so should quite high." c_maxdepth = 256 @@ -45,7 +46,7 @@ def check_depth(depth): debug_maxdepth = depth -class ConfigError(Exception): +class ConfigError(MoeError): pass class UndefinedError(ConfigError): @@ -254,7 +255,7 @@ class ConfigVar(ConfigElem): v.dependants.remove(self) # Remove the dependency on the conditions (if not used in another operation) if operation.condition and operation.condition not in [op.condition for op in self.operations]: - condition.dependants.remove(self) + operation.condition.dependants.remove(self) def evaluate(self, depth=0): """ Find the last 'SET' operation that applies and return the result of concatenating with all diff --git a/t/moe/confparser.py b/t/moe/confparser.py index e2f81b8..fed00ea 100644 --- a/t/moe/confparser.py +++ b/t/moe/confparser.py @@ -35,6 +35,8 @@ AND = FORMULA WS 'and' FORMULA OR = FORMULA WS 'or' FORMULA NOT = WS 'not' FORMULA +NOTE: ';' or '\n' is currently required even after CONDITION and SUBTREE block + TODO: change to OPERATION only NOTE: Formula may contain additional/extra parentheses EXPRESSION = '"' ( ECHAR | '{' VARNAME '}' )* '"' | re"'[^'\\n]*'" @@ -44,7 +46,7 @@ VARNAME = re('[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*') import re, types, itertools, logging as log import traceback -import conf +import moe.conf class ConfigSyntaxError(conf.ConfigError): def __init__(self, msg, fname='', line=None, column=None): -- 2.39.2