Commit 179fd38e authored by Carl Meyer's avatar Carl Meyer

No basestring in Python 3.

parent be20ec70
......@@ -2,7 +2,7 @@ from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
from django.core.exceptions import ImproperlyConfigured
from django.utils import importlib
from django.utils.datastructures import SortedDict
from .compat import smart_text, smart_bytes, python_2_unicode_compatible
from .compat import smart_text, smart_bytes, bytes_type, python_2_unicode_compatible
try:
import cPickle as pickle
......@@ -264,7 +264,7 @@ class CacheClass(BaseCache):
value = int(value)
except (ValueError, TypeError):
value = self.unpickle(value)
if isinstance(value, basestring):
if isinstance(value, bytes_type):
value = smart_text(value)
recovered_data[map_keys[key]] = value
return recovered_data
......
......@@ -12,6 +12,12 @@ except ImportError:
smart_bytes = smart_str
if PY3:
bytes_type = bytes
else:
bytes_type = str
def python_2_unicode_compatible(klass):
"""
A decorator that defines __unicode__ and __str__ methods under Python 2.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment