Hi!

   As apollo13 has suggested to me on #django I'm reporting here a
problem I've ecountered. Revision 10118 of Django has introduced some
changes to the way template filters work. I've simple filter:

@register.filter
@stringfilter
def truncatestring(src, ln):
    ret = src[:ln]
    if len(src)>ln:
        ret = ret[:ln-3]+'...'
    return ret

which is called in templates like:

{{ company.name|truncatestring:45 }}

This worked before 10118. Starting from 10118 all filter's parameters
are passed as strings (why?) so it breaks my code causing:

TypeError: slice indices must be integers or None or have an __index__
method

It's obvious because I expect "ln" to be an int in this example.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to