#27901: Problem with Django models & MySQL & custom unicode classes
-------------------------------------+-------------------------------------
Reporter: Dominique Barton | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: mysql, unicode, | Triage Stage:
error | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Dominique Barton:
Old description:
> Hi there
>
> I use a custom model field (inherited from `TextField`) which simply
> returns its value as an "enhanced" `unicode` object.
> Unfortunately, this will raise UnicodeErrors as MySQLdb apparently fails
> recognizing those values as `unicode`. The comparision isn't very clever
> there ;)
>
> MySQLdb has a `use_unicode` flag, but I don't know how to implement it in
> Django and I think this is a serious bug.
>
> I've prepared a whole test case right here: https://github.com/domibarton
> /django-mysql-unicode-error
>
> I hope this is enough for a "proper" bug description.
>
> Cheers
> Domi
New description:
Hi there
I use a custom model field (inherited from `TextField`) which simply
returns its value as an "enhanced" `unicode` object.
Unfortunately, this will raise UnicodeErrors as MySQLdb apparently fails
recognizing those values as `unicode`. The comparision isn't very clever
there ;)
MySQLdb has a `use_unicode` flag, but I don't know how to implement it in
Django and I think this is a serious bug.
I've prepared a whole test case right here: https://github.com/domibarton
/django-mysql-unicode-error
I hope this is enough for a "proper" bug description.
Cheers
Domi
'''EDIT:''' It has NOTHING to do with my custom text field, this was just
an example. Basically Django (or MySQLdb) fails when writing non-`unicode`
objects (but `unicode`-inherited objects) values to a `TextField`. Proof
for that issue is right here:
https://gist.github.com/domibarton/aa691342321f63f3511bb1ff53b946c7
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27901#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.8647513780ca0397b4e89b8d72803860%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.