Ticket #8410: patch-django.core.backends.memcached-8410.diff

File patch-django.core.backends.memcached-8410.diff, 684 bytes (added by trbs, 16 years ago)
  • django/core/cache/backends/memcached.py

    diff -r 79b314cf895d django/core/cache/backends/memcached.py
    a b  
    1717        self._cache = memcache.Client(server.split(';'))
    1818
    1919    def add(self, key, value, timeout=0):
    20         self._cache.add(key.encode('ascii', 'ignore'), value, timeout or self.default_timeout)
     20        if isinstance(value, unicode):
     21            value = value.encode('utf-8')
     22        self._cache.add(smart_str(key), value, timeout or self.default_timeout)
    2123
    2224    def get(self, key, default=None):
    2325        val = self._cache.get(smart_str(key))
Back to Top