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
c20a3223
Commit
c20a3223
authored
Aug 26, 2016
by
Tim Graham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use python_2_unicode_compatible from Django rather than compat
parent
8433d02e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
21 deletions
+4
-21
compat.py
redis_cache/compat.py
+0
-16
utils.py
redis_cache/utils.py
+4
-5
No files found.
redis_cache/compat.py
View file @
c20a3223
...
...
@@ -26,19 +26,3 @@ if django.VERSION[:2] >= (1, 6):
DEFAULT_TIMEOUT
=
DJANGO_DEFAULT_TIMEOUT
else
:
DEFAULT_TIMEOUT
=
None
def
python_2_unicode_compatible
(
klass
):
"""
A decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
returning text and apply this decorator to the class.
Backported from Django 1.5+.
"""
if
not
PY3
:
klass
.
__unicode__
=
klass
.
__str__
klass
.
__str__
=
lambda
self
:
self
.
__unicode__
()
.
encode
(
'utf-8'
)
return
klass
redis_cache/utils.py
View file @
c20a3223
...
...
@@ -2,11 +2,10 @@ import importlib
import
warnings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.utils.encoding
import
python_2_unicode_compatible
from
redis.connection
import
SSLConnection
from
redis_cache.compat
import
(
smart_text
,
python_2_unicode_compatible
,
parse_qs
,
urlparse
)
from
redis_cache.compat
import
smart_text
,
parse_qs
,
urlparse
try
:
basestring
...
...
@@ -26,13 +25,13 @@ class CacheKey(object):
def
__eq__
(
self
,
other
):
return
self
.
_versioned_key
==
other
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
smart_text
(
self
.
_versioned_key
)
def
__hash__
(
self
):
return
hash
(
self
.
_versioned_key
)
__repr__
=
__str__
=
__unicode__
__repr__
=
__str__
def
get_servers
(
location
):
...
...
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