allowing template interpreter to interpret common Python commands from template (such as len) #594

This commit is contained in:
Micah Jerome Ellison 2019-05-18 13:40:59 -07:00
parent 81dfebb2c0
commit 0a3a9241d5

View file

@ -39,7 +39,8 @@ class Template(object):
return self._expand(self.blocks[block], **vars)
def _eval_context(self, vars):
e = asteval.Interpreter(symtable=vars, use_numpy=False, writer=None)
e = asteval.Interpreter(use_numpy=False, writer=None)
e.symtable.update(vars)
e.symtable['__last_iteration'] = vars.get("__last_iteration", False)
return e