Repository navigation
Fix compiled templates depending on the directory of their source when debug is disabled - #4987
nicolas-grekas wants to merge 1 commit into
Conversation
|
The suggestion in #3218 (comment) was to compile the path relative to |
|
|
|
but resolving through the loader implies that the loader gives the same result back at the time the error is triggered than at the time the template was loaded. This is not the case when using Lines 459 to 479 in d79aaf7 |
…n debug is disabled
906bddb to
bf72fcc
Compare
|
|
Fix #3218
When debug is disabled, compiled templates now ask the loader for the path of their source when it's needed, instead of embedding it. The compiled code then doesn't depend on the directory of the project anymore: a cache warmed from a build server in another directory, as
doc/api.rstsuggests, is byte-identical, and it reports the paths where the app actually runs instead of the build directory's ones, which don't exist there.To do so,
Sourceaccepts a closure as path, called on the firstgetPath(). Only that call asks the loader the template was instantiated with, typically when an error is rendered. Debug mode still embeds the path: tools like VarDumper instantiate compiled templates without their constructor to read it.