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

Bug: using a custom jinja Environement seems to bypass a potential template callable #3791

Open
1 of 4 tasks
euri10 opened this issue Oct 14, 2024 · 1 comment · May be fixed by #3792
Open
1 of 4 tasks

Bug: using a custom jinja Environement seems to bypass a potential template callable #3791

euri10 opened this issue Oct 14, 2024 · 1 comment · May be fixed by #3792
Labels
Bug 🐛 This is something that is not working as expected

Comments

@euri10
Copy link
Contributor

euri10 commented Oct 14, 2024

Description

if using a custom env like described in https://docs.litestar.dev/2/usage/templating.html#registering-a-custom-template-engine I cannot add template callables, the registration is bypassed

URL to code causing the issue

No response

MCVE

# Your MCVE code here

Steps to reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"

Logs

No response

Litestar Version

latest

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@euri10 euri10 added the Bug 🐛 This is something that is not working as expected label Oct 14, 2024
@euri10 euri10 added this to Overview Oct 14, 2024
@github-project-automation github-project-automation bot moved this to Triage in Overview Oct 14, 2024
@euri10
Copy link
Contributor Author

euri10 commented Oct 14, 2024

one could argue given the note in the docs that the registration "should" be done manually:

The instance parameter passed to TemplateConfig can not be used in conjunction with the directory parameter, if you choose to use instance you’re fully responsible on the engine creation.

I sent a PR nonetheless but that's really open to interpretation, I'm not unhappy if it is not automatic,
it's entirely possible to do the same "manually" and to be fair I just realize I already have to do it for the flashes plugin with:
environment.globals.update(get_flashes=get_flashes)
(edit: I had not switched yet to the official plugin....)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

1 participant