diff options
author | Marius Gedminas <marius@gedmin.as> | 2013-03-15 20:18:54 +0200 |
---|---|---|
committer | Marius Gedminas <marius@gedmin.as> | 2013-03-15 20:22:10 +0200 |
commit | 12b2fdd92198d92507ca43bd52bfaf14c98c5a3c (patch) | |
tree | ed5436fc56dd35cc9098718e62e79568ab8d04b4 /src | |
parent | 493db2669365076383e52ee7d48e72bb1afd7279 (diff) | |
download | zope-pagetemplate-12b2fdd92198d92507ca43bd52bfaf14c98c5a3c.tar.gz |
Make sure ZopePythonExpr and PythonExpr are separate classes
There are ZCML files out there (zope.app.pagetemplate) that want to
define permissions for ZopePythonExpr and PythonExpr, and get conflicts
if these are two names referring to the same class.
Diffstat (limited to 'src')
-rw-r--r-- | src/zope/pagetemplate/engine.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/zope/pagetemplate/engine.py b/src/zope/pagetemplate/engine.py index d74e137..99634fa 100644 --- a/src/zope/pagetemplate/engine.py +++ b/src/zope/pagetemplate/engine.py @@ -95,16 +95,16 @@ class TrustedZopePathExpr(PathExpr): class ZopePythonExpr(PythonExpr): - def __call__(self, econtext): - __traceback_info__ = self.text - vars = self._bind_used_names(econtext, SafeBuiltins) - return eval(self._code, vars) + if HAVE_UNTRUSTED: - def _compile(self, text, filename): - return rcompile.compile(text, filename, 'eval') + def __call__(self, econtext): + __traceback_info__ = self.text + vars = self._bind_used_names(econtext, SafeBuiltins) + return eval(self._code, vars) + + def _compile(self, text, filename): + return rcompile.compile(text, filename, 'eval') -if not HAVE_UNTRUSTED: - ZopePythonExpr = PythonExpr class ZopeContextBase(Context): """Base class for both trusted and untrusted evaluation contexts.""" |