Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
179fd38e
Commit
179fd38e
authored
Jun 12, 2013
by
Carl Meyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No basestring in Python 3.
parent
be20ec70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
cache.py
redis_cache/cache.py
+2
-2
compat.py
redis_cache/compat.py
+6
-0
No files found.
redis_cache/cache.py
View file @
179fd38e
...
...
@@ -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
,
b
asestring
):
if
isinstance
(
value
,
b
ytes_type
):
value
=
smart_text
(
value
)
recovered_data
[
map_keys
[
key
]]
=
value
return
recovered_data
...
...
redis_cache/compat.py
View file @
179fd38e
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment