#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                       |  
---------------------------------------------+------------------------------
Changes (by SmileyChris):

  * stage:  Unreviewed => Design decision needed

Comment:

 I agree with dc; don't worry with a load of extra functionality (but IMO
 it should handle non-ints).

 The try/except may as well be a catch-all, too, rather than `TypeError` or
 `ValueError` specific.

 Hrm... to be totally backwards compatible, I guess that we'd need to
 continue with the current behaviour of trying to cast to int first (in
 case people are relying on adding string-integers), then fall back to a
 ducktype add.
 That's pretty annoying if you wanted to add floats/decimals though.

 I'm going to push to a design decision regarding which direction to go.
 Bring it up on the google dev group if you want some more discussion.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11687#comment:9>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to