I am trying to write an extension for Jinja2 so that I can run
arbitrary python code in my templates (I have a sandbox to run this
code safely). I know I can use something like Mako which allows
embedding python code but I prefer using Jinja2 as I like it's syntax
in general.

An example of what I intend to do in the template:

{{ x }}

{% code %}
x = x + 1
{% endcode %}

{{ x }}
If I render above template with x = 1, I expect the output to be,

1
2
I wrote an extension based on the example on the docs. I am able to
access the context by using the contextfunction decorator but it is
immutable.

Inside my callback in the extension, I would like to do something like
this

exec body in context
Can some Jinja2 guru help me out here?

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to