Opened 8 years ago

Closed 4 years ago

#9335 closed Bug (fixed)

TypedChoiceField, default empty value not unicode

Reported by: fas Owned by: fas
Component: Forms Version: 1.0
Severity: Normal Keywords: TypedChoiceField, unicode, empty, data truncated for column
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


The default empty value for the TypedChoiceField, unlike for other fields like CharField, is not unicode which can lead to the 'Data truncated for column [fieldname] at row 1' error while inserting into database. Patch provided (one-liner, against 1.0, revision 9066).

Attachments (1)

empty_field_unicode.diff (565 bytes) - added by fas 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by fas

comment:1 Changed 8 years ago by fas

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 8 years ago by kmtracey

  • Needs tests set
  • Triage Stage changed from Ready for checkin to Accepted

This looks harmless, and maybe I'm a bit dim, but I'm missing how returning '' instead of u'' can lead to 'Data truncated for column' errors. A test that exhibits the problem -- failing before the change, passing after it -- would help clarify. Even one-liner fixes deserve tests. Also, you're really not supposed to triage your own patches into 'ready for checkin' -- that's supposed to indicate another set of eyes has looked it over and agrees with the problem & fix.

comment:3 Changed 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:4 Changed 5 years ago by lukeplant

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 4 years ago by dgouldin

At this point, even if the patch did fix a data truncation error, it's irrelevant/needless due to the switch to using unicode_literals. I'm not sure there's anything left to do here.

comment:8 Changed 4 years ago by claudep

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

Thanks for catching this, closing it.

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