Jinja2 global/rendering contexts #3661
|
@ipspace How are those used in Netlab? i.e lifetimes/ access ? Can we register custom Python functions as Jinja 2 filter/functions? |
Answered by
ipspace
Jul 20, 2026
Replies: 1 comment 4 replies
Tell me more...
In theory, yes. In practice, I'd prefer if you'd do as much preprocessing as possible in Python code and then have simple templates. Let's step back and start with what exactly are you trying to solve? |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quite often caused by someone trying to be way too smart and using a long pipeline of obscure functions instead of a "for if../if loop.first" construct ;)
I worked with at least four "templating languages" (including XSLT), and they all suck in one way or another. I also had the privilege of having to deal with PHP code interspersed with verbatim text, and I wouldn't want to repeat that experience. I don't think there's a good way of solving the…