You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
{"/canonical/path/to/template.mako": <Template at 0x123>, "template.mako": <Template at 0x123>, "/path/to/template.mako": <Template at 0x123>}
the behavior turns on using a flag "canonical=True" to TemplateLookup.
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.
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: