-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
proposal - standardizing directories and template paths #259
Comments
Michael Bayer (@zzzeek) wrote: i think you mean "canonicalized". you run the paths through os.path.abspath(os.path.realpath()) in order to get the key in the lookup. This is too expensive to do for every include call, so you'd still cache on all three paths, the canonical path is only used when first creating the entry:
the behavior turns on using a flag "canonical=True" to TemplateLookup. |
jvanasco (@jvanasco) wrote: Yeah - canonical names for templates.
Is that your suggestion for implementing? That doesn't exist right now. I was thinking about augmenting the .directories with something like:
then using that cached value when generating a key. |
Michael Bayer (@zzzeek) wrote: yes, the flag would be added. The cache lookup for an <%include> should still be just one hash lookup though. Just put mulitple entries into the cache, one on the canonical path, one on the requested path. |
jvanasco (@jvanasco) wrote: gotcha. thanks. |
Migrated issue, originally created by jvanasco (@jvanasco)
I've been working on some tools to precompile templates before a webserver forks, and have run into a few issues when trying to build this out more reliably.
'directories' can be duplicates. I'm not sure this will affect anything down the line, but it might make sense. this is relatively simple to fix.
filenames aren't standardized, so the same template can become 2 objects/compiled 2 ways (relative vs absolute). this will require more thought.
The text was updated successfully, but these errors were encountered: