Opened 6 years ago

Closed 5 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: UI/UX:


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 6 years ago.
humanize ordinal TypeError? fix (updated)
humanize_ordinal_TypeError_with_tests.diff (1.3 KB) - added by punteney 5 years ago.
Updated diff with test case

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by SmileyChris

  • Patch needs improvement set

That should be:

    except (TypeError, ValueError):

Changed 6 years ago by realpolitik

humanize ordinal TypeError? fix (updated)

comment:3 Changed 6 years ago by realpolitik

  • Patch needs improvement unset

Changed 5 years ago by punteney

Updated diff with test case

comment:4 Changed 5 years ago by punteney

  • Needs tests unset

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

comment:5 Changed 5 years ago by SmileyChris

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 5 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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