Skip to content
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

Propagate ParserMacroCapture undefineds into the calls (#1424) #1425

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

beckjake
Copy link
Contributor

Fixes #1424

Just return self from ParserMacroCapture.__call__ instead of returning True. That lets jinja handle the case and return the nice error message we intended to return.

I'm sure that at some point the return True was necessary, but all the tests I've run locally (the postgres suite) seem to be totally happy with this change. And the error is much nicer.

This is happily completely orthogonal to #1416 since it's an issue in the part of jinja undefined handling that I very explicitly didn't change in that PR, so hooray for that!

Fix an issue when users attempt to use the results of missing macro calls
Add a test
@beckjake beckjake requested a review from drewbanin April 29, 2019 14:38
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I made the return value True here to try to reduce the incidence of avoidable userspace errors.

I think the return True predates some of the parsing/adapter work that we've done in the not-so-recent-anymore past. Macros will be present in the context at parse-time (this wasn't the case previously?). This is really slick, ship it!

@beckjake beckjake merged commit a4e5a5a into dev/wilt-chamberlain Apr 30, 2019
@beckjake beckjake deleted the fix/propagate-undefined-to-calls branch April 30, 2019 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iterating over the results of a missing macro gives a bad error
2 participants