-
Notifications
You must be signed in to change notification settings - Fork 2
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
caching probably not perfect #1
Comments
It'd be nice if we could have one environment per app, but the loader cannot be configured that early as the app itself has no knowledge where the templates may be - only the individual view directives know this. |
i'd suggest to discover loaders at the same time as views are discovered, my guess is, the common case is one loader per app and i wonder if more complex ones should be approached with yagni |
There is just one loader per environment though. Can have multiple items in search path but that seems wrong too. Perhaps a loader for /... |
btw, i still dont get why only views can know where templates are, |
Choice loader is a search path and search path is not what I want. Though that reminds me of common practice to override templates through search path stuff in Jinja2. Not sure how to support (or even if). Maybe a loader that can load views.. See here the docs on how the Morepath template integration works now: |
the scheme seems rather impractical/uncommon, you need to make a custom jinja loader that maps paths to packages i suppose, |
bascially sane inheritance would be total hell with all templates are next to the modules |
You don't have to put the templates next to the modules. You can put them in a subdir next to the modules. There's an actual test that tests inheritance already: I don't think the scheme is impractical at all. Anyway, all this got me thinking about how to override templates the Morepath way, and I have an idea.. |
hmm, maybe im having a waay different structure in mind, but im coming from the common flask and/or django setup there |
I'm recreating the environment each time a template gets created now. This probably breaks caching when template inheritance is in use. (need to review the code)
It would be nice if we could share the environment if it's the same. I'm not entirely sure how to proceed.
One way to improve would be to pass in a template search path and a template name in from Morepath instead, and then cache environments on a search path basis.
The text was updated successfully, but these errors were encountered: