# HG changeset patch # User cmlenz # Date 1195760117 0 # Node ID 23b5138fd8353a2a45954500027b70b0a8f8f7f6 # Parent 157982470992af885934650e213f1942eda9e71f Fix thread-safety problem in template code evaluation. Closes #158. Thanks to Christian Boos for the patch. diff --git a/genshi/template/eval.py b/genshi/template/eval.py --- a/genshi/template/eval.py +++ b/genshi/template/eval.py @@ -73,7 +73,7 @@ lookup = LenientLookup elif isinstance(lookup, basestring): lookup = {'lenient': LenientLookup, 'strict': StrictLookup}[lookup] - self._globals = lookup.globals() + self._globals = lookup.globals def __eq__(self, other): return (type(other) == type(self)) and (self.code == other.code) @@ -139,7 +139,7 @@ :return: the result of the evaluation """ __traceback_hide__ = 'before_and_this' - _globals = self._globals + _globals = self._globals() _globals['data'] = data return eval(self.code, _globals, {'data': data}) @@ -161,7 +161,7 @@ :param data: a mapping containing the data to execute in """ __traceback_hide__ = 'before_and_this' - _globals = self._globals + _globals = self._globals() _globals['data'] = data exec self.code in _globals, data