{{{
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn(u'清')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/warnings.py", line 33, in _show_warning
file.write(formatwarning(message, category, filename, lineno, line))
File "/usr/lib/python2.7/warnings.py", line 42, in formatwarning
s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__,
message)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u6e05' in
position 0: ordinal not in range(128)
}}}
`BaseCache.validate_key()`
[https://github.com/django/django/blob/d356bb653f4d90ae9809e5a051791ded39010c38/django/core/cache/backends/base.py#L237-L238
fails to create a proper `message`] by using `"%s"` to interpolate the key
into the `message` instead of using `"%r"`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26462>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* component: Uncategorized => Core (Cache system)
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26462#comment:1>
* version: 1.9 => master
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26462#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"90ce5d46bf62a74d7c78a61c1a7bab64f7cb1735" 90ce5d46]:
{{{
#!CommitTicketReference repository=""
revision="90ce5d46bf62a74d7c78a61c1a7bab64f7cb1735"
Fixed #26462 -- Fixed Python 2 UnicodeEncodeError when warning about long
cache keys.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26462#comment:3>