carlxaeron / django-rosetta

Automatically exported from code.google.com/p/django-rosetta
MIT License
0 stars 0 forks source link

Rosetta depends on django 1.2 (uses 'add' in template with non-integers) #108

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you install rosetta on django 1.1, you can get this template syntax error on 
pages:

    Exception Type: TypeError at /rosetta/
    Exception Value: int() argument must be a string or a number, not 'list'

This is caused by the line (in rosetta/templates/rosetta/languages.html)

    <td class="ch-messages r">{{po.translated_entries|add:po.untranslated_entries|length}}</td>

Django's add template filter (as of Django 1.2: 
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#add ) will try to 
convert arguments to integers, making this code work. In Django 1.1, the add 
template filter doesn't do this, and so this error occurs.

Attached is a patch that will make this template work on Django 1.1. It should 
also work on 1.2, 1.3, and up (but I haven't tested that)

Original issue reported on code.google.com by ebelu...@gmail.com on 8 Apr 2011 at 10:43

Attachments:

GoogleCodeExporter commented 8 years ago
Odd, I ran the testcases trough a 1.1 install and they all passed. By looking 
at the code this makes perfect sense, though.

Thanks for the patch. Fixed in r123.

Original comment by mbonetti on 8 Apr 2011 at 1:04