#20572: locale fr_FR.UTF-8 breaks loaddata
-------------------------------------+-------------------------------------
Reporter: gerard.henry@… | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.5
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by claudep):
Also note that this is a Python2-only issue.
Some possible solutions:
* using `%r` instead `%s`. Drawback: the resulting message is not quite
the same:
{{{
e.args = ("Problem installing fixtures: %s" % e,)
(u"Problem installing fixtures: The row in table 'fixtures_regress_book'
with primary key '1' has an invalid
foreign key: fixtures_regress_book.author_id contains a value '3' that
does not have a corresponding value in
fixtures_regress_person.id.",)
e.args = ("Problem installing fixtures: %r" % e,)
(u'Problem installing fixtures: IntegrityError(u"The row in table
\'fixtures_regress_book\' with primary key
\'1\' has an invalid foreign key: fixtures_regress_book.author_id contains
a value \'3\' that does not have a
corresponding value in fixtures_regress_person.id.",)',)
}}}
And we should still track this pattern all over Django code.
* using `force_text` in `DatabaseErrorWrapper` to convert message to
unicode.[[BR]]
Drawback: non-ascii unicode args for exceptions are not well supported,
notably in unittest2 `assertRaisesRegexp` where `str(exc_value)` will
raise a `UnicodeEncodeError`.
* using `force_text(s, 'ascii', errors='ignore')` in
`DatabaseErrorWrapper` to strip out any non-ascii char from the exception
message.[[BR]]
Drawback: the error message will be altered.
Opinions or other solutions welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/20572#comment:3>
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/082.3afc5cb1e5caca3d998cebc8b9b74c1b%40djangoproject.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.