Skip to content

Map filter can use False as default#1356

Merged
davidism merged 1 commit intopallets:masterfrom
BALaka-18:map-filter-default
Feb 25, 2021
Merged

Map filter can use False as default#1356
davidism merged 1 commit intopallets:masterfrom
BALaka-18:map-filter-default

Conversation

@BALaka-18
Copy link
Copy Markdown
Contributor

@BALaka-18 BALaka-18 commented Feb 22, 2021

According to Issue #1331, the map filter doesn't allow values like [],{},(),None etc ( that automatically default to False ) to be set as the value to the default argument. The user can now set False values to the default argument of the map filter in Jinja2.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

Comment thread src/jinja2/filters.py Outdated
@davidism davidism added this to the 3.0.0 milestone Feb 25, 2021
@davidism davidism merged commit 8ab9db2 into pallets:master Feb 25, 2021
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

map filter: can't use a false, '', None, [], {} as default (or anything that is automatically cast to false)

3 participants