Skip to content
Browse files

Fixed #8410 -- Added a missing piece of value encoding for the memcached

backend. Patch from trbs.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent ba937e5 commit e7769c36e9a95312879e74c2dd32695d3165037b @malcolmt malcolmt committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/core/cache/backends/
4 django/core/cache/backends/
@@ -17,7 +17,9 @@ def __init__(self, server, params):
self._cache = memcache.Client(server.split(';'))
def add(self, key, value, timeout=0):
- return self._cache.add(key.encode('ascii', 'ignore'), value, timeout or self.default_timeout)
+ if isinstance(value, unicode):
+ value = value.encode('utf-8')
+ return self._cache.add(smart_str(key), value, timeout or self.default_timeout)
def get(self, key, default=None):
val = self._cache.get(smart_str(key))

0 comments on commit e7769c3

Please sign in to comment.
Something went wrong with that request. Please try again.