#10143: "add" template filter always converts arguments to integers
---------------------------------------------+------------------------------
          Reporter:  jfw                     |         Owner:  nobody
            Status:  new                     |     Milestone:        
         Component:  Template system         |       Version:  1.0   
        Resolution:                          |      Keywords:        
             Stage:  Design decision needed  |     Has_patch:  0     
        Needs_docs:  0                       |   Needs_tests:  0     
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Changes (by jacob):

  * needs_better_patch:  => 0
  * stage:  Unreviewed => Design decision needed
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 There has to be a cast to make it work in a sane manner since the argument
 passed to filters always comes in as a string. So if you've got `{{
 foo|add:"1" }}`, Django has no way of knowing if you meant "add 1 to the
 number `foo`" (which should fail if `foo` isn't an integer) or "append the
 string '1' to the variable `foo`" (which should fail if `foo` isn't a
 string).

 Bright ideas welcome, but I don't see a good way to solve this without a
 huge tree of `isinstance` checks, which would be nasty.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10143#comment:1>
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 django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to