equal
deleted
inserted
replaced
180 |
180 |
181 def expandInline(self, context, outputFile, interpreter): |
181 def expandInline(self, context, outputFile, interpreter): |
182 """ Internally used when expanding a template that is part of a context.""" |
182 """ Internally used when expanding a template that is part of a context.""" |
183 try: |
183 try: |
184 interpreter.execute(self) |
184 interpreter.execute(self) |
185 except UnicodeError, unierror: |
185 except UnicodeError as unierror: |
186 LOGGER.exception(str(unierror)) |
186 LOGGER.exception(str(unierror)) |
187 raise simpleTALES.ContextContentException("found non-unicode %r string in Context!" % unierror.args[1]), None, sys.exc_info()[-1] |
187 raise simpleTALES.ContextContentException("found non-unicode %r string in Context!" % unierror.args[1]), None, sys.exc_info()[-1] |
188 |
188 |
189 |
189 |
190 def compile_template(template): |
190 def compile_template(template): |
228 value = value.rawValue() |
228 value = value.rawValue() |
229 locals[name] = value |
229 locals[name] = value |
230 # XXX precompile expr will avoid late syntax error |
230 # XXX precompile expr will avoid late syntax error |
231 try: |
231 try: |
232 result = eval(expr, globals, locals) |
232 result = eval(expr, globals, locals) |
233 except Exception, ex: |
233 except Exception as ex: |
234 ex = ex.__class__('in %r: %s' % (expr, ex)) |
234 ex = ex.__class__('in %r: %s' % (expr, ex)) |
235 raise ex, None, sys.exc_info()[-1] |
235 raise ex, None, sys.exc_info()[-1] |
236 if (isinstance (result, simpleTALES.ContextVariable)): |
236 if (isinstance (result, simpleTALES.ContextVariable)): |
237 return result.value() |
237 return result.value() |
238 return result |
238 return result |