#11687: The 'add' template filter only works for integers, and can fail noisily
---------------------------------------------+------------------------------
Reporter: thepointer | Owner: gruszczy
Status: new | Milestone: 1.2
Component: Template system | Version: 1.1
Resolution: | Keywords:
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by SmileyChris):
You may have had that view because Django templates always applie
``unicode()`` to the final output of variable tags. Glad we got to the
conclusion in the end :)
I'll review your patch when it comes in and push forwards if it's all
good. Remember, we need to keep the current behaviour so it should look
something like this:
{{{
#!python
try:
value, arg = int(value), int(arg)
except (TypeError, ValueError):
pass
try:
return value + arg
except:
return value
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/11687#comment:16>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---