1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

Fixed #18400 -- Modified length template filter to return 0 for unknown variables.

Thanks Florian for the bug report, luyikei for the initial code patch, and
Bouke for the code review feedback.
This commit is contained in:
Susan Tan
2013-10-14 22:15:13 -07:00
committed by Tim Graham
parent 84cafc2b35
commit 484f3edf1e
4 changed files with 11 additions and 3 deletions

View File

@@ -578,7 +578,7 @@ def length(value):
try:
return len(value)
except (ValueError, TypeError):
return ''
return 0
@register.filter(is_safe=False)