changeset 654:12f3a60d5528

Fix thread-safety problem in template code evaluation. Closes #158. Thanks to Christian Boos for the patch.
author cmlenz
date Thu, 22 Nov 2007 19:35:17 +0000
parents ca37a9301a20
children b090bf737111
files genshi/template/eval.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
 
Copyright (C) 2012-2017 Edgewall Software