summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSusan Tan <onceuponatimeforever@gmail.com>2013-10-14 22:15:13 -0700
committerTim Graham <timograham@gmail.com>2014-06-05 15:41:56 -0400
commit484f3edf1e79388f73dcb07e39d79d0c5029ae9e (patch)
tree0b2ec38c385a9aa697b3d8cc8986264997d03604 /django
parent84cafc2b3575fe1040c5ed98d3f82d3b42d606f7 (diff)
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.
Diffstat (limited to 'django')
-rw-r--r--django/template/defaultfilters.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index bb883d0fc6..e6a0c619dc 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -578,7 +578,7 @@ def length(value):
try:
return len(value)
except (ValueError, TypeError):
- return ''
+ return 0
@register.filter(is_safe=False)