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

make the "default" filter match the behavior of Jinja for falsy values #141

Closed
wants to merge 1 commit into from
Closed

Conversation

chrisdanford
Copy link

Falsy values shouldn't be replaced by the default value unless the optional "bool" parameter is truthy. See http://jinja.pocoo.org/docs/templates/#default.

screen shot 2013-10-27 at 10 50 50 pm

See http://jinja.pocoo.org/docs/templates/#default.  Falsy values
shouldn't be replaced by the default value unless the optional "bool"
parameter is truthy.
@jlongster
Copy link
Contributor

I can see the reasoning for this, but it sucks to possibly break people's existing templates. I like that it maps directly to foo || bar, but I realize now it's not meant for that. Also, in nunjucks {{ foo or bar }} works the way it does in JS, so that's what you should be doing if you want it to act that way.

Thanks, this will have to go out in 1.1 (no breaking changes in .0.1 releases) so I'm going to wait to merge this until I make sure 1.0 is stable.

@mattbasta
Copy link
Contributor

We should have a branch for 1.1

@jlongster
Copy link
Contributor

Yep, let's do that. I always hate asking people to change branches in their PRs but only bigger changes need it, like this one. Chris, I just created a 1.1 branch, can you change the target of this PR to it?

@chrisdanford
Copy link
Author

I'm probably blind, but I couldn't figure out how to change the target branch on a PR without creating a new one. This seems to indicate that it's not possible isaacs/github#18. I created a new PR.

Thanks James!

@jlongster
Copy link
Contributor

Thanks! I'm pretty sure you can somewhere but I don't have any PRs right now to check... The new UI made PRs so much more confusing than they used to be.

@jlongster jlongster closed this Oct 28, 2013
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.

3 participants