1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #11687: the add filter is now less failsome when faced with things that can't be coerced to integers.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2010-02-22 23:34:33 +00:00
parent eb0751a4c0
commit 49d6a82261
3 changed files with 39 additions and 1 deletions

View File

@@ -651,7 +651,13 @@ unordered_list.needs_autoescape = True
def add(value, arg):
"""Adds the arg to the value."""
return int(value) + int(arg)
try:
return int(value) + int(arg)
except (ValueError, TypeError):
try:
return value + arg
except:
return value
add.is_safe = False
def get_digit(value, arg):