Mercurial > genshi > mirror
diff genshi/template/eval.py @ 343:35189e960252 trunk
Remove automatic calling of expression evaluation results if they are callable. See [http://groups.google.com/group/genshi/browse_thread/thread/f515986760918d41 this mailing list thread].
author | cmlenz |
---|---|
date | Fri, 10 Nov 2006 10:00:44 +0000 |
parents | b517929eb334 |
children | 62de137b9322 |
line wrap: on
line diff
--- a/genshi/template/eval.py +++ b/genshi/template/eval.py @@ -95,22 +95,17 @@ def __repr__(self): return 'Expression(%r)' % self.source - def evaluate(self, data, nocall=False): + def evaluate(self, data): """Evaluate the expression against the given data dictionary. @param data: a mapping containing the data to evaluate against - @param nocall: if true, the result of the evaluation is not called if - if it is a callable @return: the result of the evaluation """ - retval = eval(self.code, {'data': data, - '_lookup_name': _lookup_name, - '_lookup_attr': _lookup_attr, - '_lookup_item': _lookup_item}, - {'data': data}) - if not nocall and type(retval) is not Undefined and callable(retval): - retval = retval() - return retval + return eval(self.code, {'data': data, + '_lookup_name': _lookup_name, + '_lookup_attr': _lookup_attr, + '_lookup_item': _lookup_item}, + {'data': data}) class Undefined(object):