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
This commit is contained in:
Malcolm Tredinnick 2008-08-19 20:35:56 +00:00
parent ba937e55ae
commit e7769c36e9
1 changed files with 3 additions and 1 deletions

View File

@ -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))