1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #26462 -- Fixed Python 2 UnicodeEncodeError when warning about long cache keys.

This commit is contained in:
Przemysław Suliga
2016-04-04 20:18:11 +02:00
committed by Tim Graham
parent 369fa471f4
commit 90ce5d46bf
2 changed files with 19 additions and 3 deletions

View File

@@ -235,7 +235,7 @@ class BaseCache(object):
"""
if len(key) > MEMCACHE_MAX_KEY_LENGTH:
warnings.warn('Cache key will cause errors if used with memcached: '
'%s (longer than %s)' % (key, MEMCACHE_MAX_KEY_LENGTH),
'%r (longer than %s)' % (key, MEMCACHE_MAX_KEY_LENGTH),
CacheKeyWarning)
for char in key:
if ord(char) < 33 or ord(char) == 127: