comparison markup/eval.py @ 90:242610137d1f

When an expression evaluates to a callable, it is called implicitly.
author cmlenz
date Wed, 19 Jul 2006 17:50:17 +0000
parents 9ecae580dd93
children bc73d3ab823f
comparison
equal deleted inserted replaced
89:d4c7617900e3 90:242610137d1f
80 """Evaluate the expression against the given data dictionary. 80 """Evaluate the expression against the given data dictionary.
81 81
82 @param data: a mapping containing the data to evaluate against 82 @param data: a mapping containing the data to evaluate against
83 @return: the result of the evaluation 83 @return: the result of the evaluation
84 """ 84 """
85 return eval(self.code) 85 retval = eval(self.code)
86 if callable(retval):
87 retval = retval()
88 return retval
86 89
87 def _compile(self, source, filename, lineno): 90 def _compile(self, source, filename, lineno):
88 tree = parse(self.source, 'eval') 91 tree = parse(self.source, 'eval')
89 xform = ExpressionASTTransformer() 92 xform = ExpressionASTTransformer()
90 tree = xform.visit(tree) 93 tree = xform.visit(tree)
Copyright (C) 2012-2017 Edgewall Software