Author: mtredinnick
Date: 2008-08-19 15:35:56 -0500 (Tue, 19 Aug 2008)
New Revision: 8444

Modified:
   django/trunk/django/core/cache/backends/memcached.py
Log:
Fixed #8410 -- Added a missing piece of value encoding for the memcached
backend. Patch from trbs.


Modified: django/trunk/django/core/cache/backends/memcached.py
===================================================================
--- django/trunk/django/core/cache/backends/memcached.py        2008-08-19 
20:27:41 UTC (rev 8443)
+++ django/trunk/django/core/cache/backends/memcached.py        2008-08-19 
20:35:56 UTC (rev 8444)
@@ -17,7 +17,9 @@
         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))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to