Opened 17 years ago
Closed 13 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)
Change History (9)
by , 17 years ago
| Attachment: | empty_field_unicode.diff added |
|---|
comment:1 by , 17 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:2 by , 17 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Ready for checkin → Accepted |
comment:4 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → Bug |
comment:7 by , 13 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 , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Thanks for catching this, closing it.
This looks harmless, and maybe I'm a bit dim, but I'm missing how returning
''instead ofu''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.