Author: adrian Date: 2010-01-10 15:37:20 -0600 (Sun, 10 Jan 2010) New Revision: 12199
Modified: django/trunk/django/contrib/humanize/templatetags/humanize.py django/trunk/tests/regressiontests/humanize/tests.py Log: Fixed #11783 -- ordinal template tag now catches TypeError. Thanks, realpolitik and punteney Modified: django/trunk/django/contrib/humanize/templatetags/humanize.py =================================================================== --- django/trunk/django/contrib/humanize/templatetags/humanize.py 2010-01-10 21:36:12 UTC (rev 12198) +++ django/trunk/django/contrib/humanize/templatetags/humanize.py 2010-01-10 21:37:20 UTC (rev 12199) @@ -14,7 +14,7 @@ """ try: value = int(value) - except ValueError: + except (TypeError, ValueError): return value t = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th')) if value % 100 in (11, 12, 13): # special case Modified: django/trunk/tests/regressiontests/humanize/tests.py =================================================================== --- django/trunk/tests/regressiontests/humanize/tests.py 2010-01-10 21:36:12 UTC (rev 12198) +++ django/trunk/tests/regressiontests/humanize/tests.py 2010-01-10 21:37:20 UTC (rev 12199) @@ -22,10 +22,10 @@ def test_ordinal(self): test_list = ('1','2','3','4','11','12', '13','101','102','103','111', - 'something else') + 'something else', None) result_list = ('1st', '2nd', '3rd', '4th', '11th', '12th', '13th', '101st', '102nd', '103rd', - '111th', 'something else') + '111th', 'something else', None) self.humanize_tester(test_list, result_list, 'ordinal')
-- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@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.