Code

Ticket #11783: humanize_ordinal_TypeError.diff

File humanize_ordinal_TypeError.diff, 562 bytes (added by realpolitik, 5 years ago)

humanize ordinal TypeError? fix (updated)

Line 
1Index: django/contrib/humanize/templatetags/humanize.py
2===================================================================
3--- django/contrib/humanize/templatetags/humanize.py    (revision 11477)
4+++ django/contrib/humanize/templatetags/humanize.py    (working copy)
5@@ -14,7 +14,7 @@
6     """
7     try:
8         value = int(value)
9-    except ValueError:
10+    except (TypeError, ValueError):
11         return value
12     t = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th'))
13     if value % 100 in (11, 12, 13): # special case