Commit e7769c36 authored by Malcolm Tredinnick's avatar Malcolm Tredinnick
Browse files

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

backend. Patch from trbs.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent ba937e55
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@ class CacheClass(BaseCache):
        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))