Closed sisp closed 3 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.72%. Comparing base (
05aa175
) to head (6cb92f9
). Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Caching! Always tempting us, and stabbing us in the back once we succumbed.
I've fixed a bug related to rendering a template answers file name/path in combination with
_message_before_copy
.The reason for this bug is as follows: When
_message_before_copy
is set, Copier renders this message before starting the questionnaire, and thus at this point the render context does not include any answers of questions, so rendering the templated_answers_file
value leads to an incorrect result – but there's likely no practical reason to render the answers file in the pre-copy message. But rendering the pre-copy message requires the render context which contains the rendered answers file and prior to this PR the rendered answers file value was cached, hence the incorrect value was cached when the first render context was produced for rendering the pre-copy message.This PR solves the problem by simply re-rendering the answers file path every time a render context is produced.
By the way, this bug would have been caught with less confusion if Copier had supported configuring Jinja with
StrictUndefined
. :nerd_face:Fixes #1825.