Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set evniroment for jinja2 engine #744

Open
TomFreudenberg opened this issue Feb 7, 2025 · 2 comments
Open

Set evniroment for jinja2 engine #744

TomFreudenberg opened this issue Feb 7, 2025 · 2 comments

Comments

@TomFreudenberg
Copy link
Contributor

Hey @derks

I want to change some defaults for rendering:

jinja2_template_handler = app.handler.resolve('template','jinja2')
jinja2_template_handler.env.trim_blocks = True

How ever I try to adjust my settings, even within a post_setup() hook,
it does not reflect the rendering.

While debugging before line:

https://github.com/datafolklabs/cement/blob/main/cement/ext/ext_jinja2.py#L120

the value stays still on False.

When I apply my changes at:

https://github.com/datafolklabs/cement/blob/main/cement/ext/ext_jinja2.py#L96-L98

it works directly.


So what would you suppose where and how to change the env settings?

Btw. is there a reason you haven't allow a config part for this?

Kind regards
Tom

@TomFreudenberg
Copy link
Contributor Author

Hey @derks

I created a derived extension for jinja2 and allow to do some config settings.

If you like a PR for your main jinja2 let me know.

Kind regards
Tom

@TomFreudenberg
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant