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

Support for the boolean() filter #52

Closed
digitalresistor opened this issue Feb 6, 2022 · 1 comment · Fixed by #53
Closed

Support for the boolean() filter #52

digitalresistor opened this issue Feb 6, 2022 · 1 comment · Fixed by #53

Comments

@digitalresistor
Copy link
Contributor

digitalresistor commented Feb 6, 2022

As I am going through and trying to use this, it would be great if there was a standard boolean filter that takes in text and returns true for values like:

  • yes
  • true
  • True

and then false for string values like this:

  • false
  • False
  • no

Although I am not sure if that is what the Jinja2 filter does, or if I am thinking of the ansible bool filter instead...

@mitsuhiko
Copy link
Owner

I will add this for compatibility but in practical terms it's rarely useful as {% if foo %} is the same as {% if foo|bool %}. I do see it being useful for ansible type uses though and it will become more useful if we do #50.

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 a pull request may close this issue.

2 participants