
Jinja live parser - networked
http://jinja2test.tk/
======
tbarbugli
Is the source code available anywhere? I could actually use this myself. FYI
Jinja2 is really powerful and allows you to use lot of stuff from Python (eg.
execute heavy math operations, allocate lot of memory, iterate forever...)

Eg. if you paste {% for i in range(10000000000) %}{% endfor %} and press
Convert tens of times it will take down your site.

~~~
networked
The source is at [https://github.com/qn7o/jinja2-live-
parser](https://github.com/qn7o/jinja2-live-parser).

(I submitted the story but I am not the developer.)

------
xandr
I stopped hosting this site, because everyone started to try "{% for i in
range(10000000000) %}{% endfor %}". Stop, please, don't do it. I have not
enough time for writing code to check all jinja filters and determine heavy
work, if you can do it please make a pull request to original source or my
fork [https://github.com/xandr2/jinja2-live-
parser](https://github.com/xandr2/jinja2-live-parser) . Originally I created
this to help people who need fast check their ansible playbooks with jinja2
template rules. [http://stackoverflow.com/questions/35407822/how-can-i-
test-j...](http://stackoverflow.com/questions/35407822/how-can-i-test-
jinja2-templates-in-ansible/)

~~~
rbut
Two things I recommend you do before hosting it again.

1\. Use SandboxedEnvironment instead of Environment.

2\. Render the template via multiprocessing with a 10 second timeout. This
should solve some of your DOS issues.

~~~
xandr
Thank you, I will try it.

------
tbarbugli
I've added support for Heroku deploy button on my fork:
[https://github.com/GetStream/jinja2-live-
parser](https://github.com/GetStream/jinja2-live-parser)

~~~
tbarbugli
live here too now :) [https://cryptic-
cliffs-32040.herokuapp.com/](https://cryptic-cliffs-32040.herokuapp.com/)

------
neduma
It's gonna help us for ansible/salt templates work. thanks

------
reachtarunhere
Can anyone please help me understand where this can be put to use? Few
comments have already mentioned some stuff vaguely. Any concrete example will
really help.

~~~
bogomipz
Sure, one use case would be Ansible. Where you frequently use complex jina
filters on variables that are passed in via a variable file or dynamically at
run time. Debugging these can be time consuming if you have to do run the
Ansible playbook every time only to find out there a problem with your filter
or templating logic.

