Opened 15 years ago

Closed 15 years ago

#11783 closed (fixed)

django.contrib.humanize.templatetags.ordinal throws TypeError for NoneType

Reported by: realpolitik Owned by: nobody
Component: Contrib apps Version: 1.1
Severity: Keywords: contrib, humanize, ordinal, ValueError
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The short summary probably covered everything. ordinal(value) catches ValueError but not TypeError.

Error Message: "Exception Value: int() argument must be a string or a number, not 'NoneType'"

Attachments (2)

humanize_ordinal_TypeError.diff (562 bytes ) - added by realpolitik 15 years ago.
humanize ordinal TypeError? fix (updated)
humanize_ordinal_TypeError_with_tests.diff (1.3 KB ) - added by punteney 15 years ago.
Updated diff with test case

Download all attachments as: .zip

Change History (8)

comment:1 by Alex Gaynor, 15 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 by Chris Beaven, 15 years ago

Patch needs improvement: set

That should be:

    except (TypeError, ValueError):

by realpolitik, 15 years ago

humanize ordinal TypeError? fix (updated)

comment:3 by realpolitik, 15 years ago

Patch needs improvement: unset

by punteney, 15 years ago

Updated diff with test case

comment:4 by punteney, 15 years ago

Needs tests: unset

Added a test to the patch to check for the None TypeError

comment:5 by Chris Beaven, 15 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Adrian Holovaty, 15 years ago

Resolution: fixed
Status: newclosed

(In [12199]) Fixed #11783 -- ordinal template tag now catches TypeError. Thanks, realpolitik and punteney

Note: See TracTickets for help on using tickets.
Back to Top