[Zope3-checkins] SVN: Zope3/trunk/src/zope/tales/pythonexpr.py
separate the compilation step from the rest of the initialization so
Fred L. Drake, Jr.
fred at zope.com
Thu Jul 22 11:21:40 EDT 2004
Log message for revision 26679:
separate the compilation step from the rest of the initialization so
it can be overridden by a subclass
Changed:
U Zope3/trunk/src/zope/tales/pythonexpr.py
-=-
Modified: Zope3/trunk/src/zope/tales/pythonexpr.py
===================================================================
--- Zope3/trunk/src/zope/tales/pythonexpr.py 2004-07-22 14:02:17 UTC (rev 26678)
+++ Zope3/trunk/src/zope/tales/pythonexpr.py 2004-07-22 15:21:40 UTC (rev 26679)
@@ -20,13 +20,16 @@
def __init__(self, name, expr, engine):
text = ' '.join(expr.splitlines()).strip()
self.text = text
- # The next line can legally raise SyntaxError.
try:
- self._code = code = compile(text, '<string>', 'eval')
+ code = self._compile(text, '<string>')
except SyntaxError, e:
raise engine.getCompilerError()(str(e))
+ self._code = code
self._varnames = code.co_names
+ def _compile(self, text, filename):
+ return compile(text, filename, 'eval')
+
def _bind_used_names(self, econtext, builtins):
# Bind template variables
names = {}
More information about the Zope3-Checkins
mailing list