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

Attachment: empty_field_unicode.diff added

comment:1 Changed 8 years ago by fas

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 8 years ago by Karen Tracey

Needs tests: set
Triage Stage: Ready for checkinAccepted

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 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 Changed 5 years ago by Luke Plant

Severity: Normal
Type: Bug

comment:5 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 Changed 4 years ago by David Gouldin

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 Claude Paroz

Resolution: fixed
Status: newclosed

Thanks for catching this, closing it.

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