From b25bd85b82120b565d4497937566a2bc64eda6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kom=D1=8Fpa?= Date: Tue, 29 Jun 2010 13:38:59 +0300 Subject: [PATCH] minor fix: tags => tag, non-failing eval() --- src/mapcss/Eval.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mapcss/Eval.py b/src/mapcss/Eval.py index 3d69b0e..f8029cd 100644 --- a/src/mapcss/Eval.py +++ b/src/mapcss/Eval.py @@ -35,9 +35,9 @@ class Eval(): tag[k] = float(v) except: pass - # try: - return str(eval(self.expr, {}, { - "tags":lambda x: tags.get(x,""), + try: + return str(eval(self.expr, {}, { + "tag":lambda x: tags.get(x,""), "prop":lambda x: props.get(x,""), "num": m_num, "metric": lambda x: m_metric(x, xscale), @@ -45,8 +45,8 @@ class Eval(): "str": str, "any": m_any, })) - # except: - # return "" + except: + return "" def __repr__(self): @@ -94,6 +94,6 @@ def m_metric(x, t): if __name__ == "__main__": - a = Eval("""eval( any(metric(tags("height")), metric ( tags("building:levels") ) * 3))""") + a = Eval("""eval( any(metric(tag("height")), metric ( tag("building:levels") ) * 3))""") print repr(a) print a.compute({"building:levels":"3m"}) \ No newline at end of file