Ticket #16993: fix-cache.base.backends.get_default_key-smart_str_on_result.patch

File fix-cache.base.backends.get_default_key-smart_str_on_result.patch, 931 bytes (added by adsworth, 13 years ago)
  • django/core/cache/backends/base.py

    diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
    index 9824fc4..5861eaf 100644
    a b def default_key_func(key, key_prefix, version):  
    2424    the `key_prefix'. KEY_FUNCTION can be used to specify an alternate
    2525    function with custom key making behavior.
    2626    """
    27     return ':'.join([key_prefix, str(version), smart_str(key)])
     27    return smart_str(':'.join([key_prefix, str(version), key]))
    2828
    2929def get_key_func(key_func):
    3030    """
    class BaseCache(object):  
    6363        except (ValueError, TypeError):
    6464            self._cull_frequency = 3
    6565
    66         self.key_prefix = smart_str(params.get('KEY_PREFIX', ''))
     66        self.key_prefix = params.get('KEY_PREFIX', '')
    6767        self.version = params.get('VERSION', 1)
    6868        self.key_func = get_key_func(params.get('KEY_FUNCTION', None))
    6969
Back to Top