Opened 15 years ago

Closed 12 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

Description

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 15 years ago.

Download all attachments as: .zip

Change History (9)

by fas, 15 years ago

Attachment: empty_field_unicode.diff added

comment:1 by fas, 15 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Karen Tracey, 15 years ago

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

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 by Luke Plant, 13 years ago

Severity: Normal
Type: Bug

comment:5 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 by David Gouldin, 12 years ago

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 by Claude Paroz, 12 years ago

Resolution: fixed
Status: newclosed

Thanks for catching this, closing it.

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