-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I encountered the issue where when a Jinja template sets a variable to `none`, it treats it as a variable name and sets its value to `undefined`, and then checking that the variable value is not `none` fails. Given this template: ``` {%- if not null_val is defined -%} {%- set null_val = none -%} {%- endif -%} {%- if null_val is not none -%} {{- 'fail' -}} {%- else -%} {{- 'pass' -}} {%- endif -%} ``` The current code will set `null_val` to `undefined`, then `null_val is not none` will be interpreted as `true` (since `undefined !== null`), and thus it'll render "fail". This PR fixes that by interpreting a variable named `none` as a `NullValue`, since `none` should be a reserved keyword. --------- Co-authored-by: Joshua Lochner <admin@xenova.com>
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters