litestar-org/litestar

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

euri10 opened this issue · 1 comments

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

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....)