          # We need to differentiate between "provided, but using default value",
          # and "not provided". If the value is provided using a default, then
          # we fall back to system defaults. If it is not provided at all,
          # we need to use middleware defaults.
          try:
              cache_alias = kwargs.get('cache_alias')
              if cache_alias is None:
                  cache_alias = DEFAULT_CACHE_ALIAS
              if cache_timeout is not None:
 
</s> remove         self.cache_timeout = cache_timeout
        if cache_timeout is None:
            self.cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS

 </s> add  </s> remove 
        cache_kwargs = {}
        try:
            key_prefix = kwargs.get('key_prefix')
            if key_prefix is not None:
                cache_kwargs['KEY_PREFIX'] = key_prefix
        except KeyError:
            cache_kwargs['KEY_PREFIX'] = settings.CACHE_MIDDLEWARE_KEY_PREFIX
 </s> add             if cache_timeout is None:
                cache_kwargs['TIMEOUT'] = settings.CACHE_MIDDLEWARE_SECONDS
            else:
                cache_kwargs['TIMEOUT'] = cache_timeout </s> remove             cache_key = get_cache_key(request, self.key_prefix, 'HEAD')
 </s> add             cache_key = get_cache_key(request, self.key_prefix, 'HEAD', cache=self.cache) </s> remove         cache_key = get_cache_key(request, self.key_prefix, 'GET')

 </s> add         cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)
        cache_kwargs = {}
        try:
            self.key_prefix = kwargs.get('key_prefix')
            if self.key_prefix is not None:
                cache_kwargs['KEY_PREFIX'] = self.key_prefix
            else:
                self.key_prefix = ''
        except KeyError:
            self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
            cache_kwargs['KEY_PREFIX'] = self.key_prefix
          # We need to differentiate between "provided, but using default value",
          # and "not provided". If the value is provided using a default, then
          # we fall back to system defaults. If it is not provided at all,
          # we need to use middleware defaults.
        cache_kwargs = {}
        try:
            self.key_prefix = kwargs.get('key_prefix')
            if self.key_prefix is not None:
                cache_kwargs['KEY_PREFIX'] = self.key_prefix
            else:
                self.key_prefix = ''
        except KeyError:
            self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
            cache_kwargs['KEY_PREFIX'] = self.key_prefix
          try:
              cache_alias = kwargs.get('cache_alias')
              if cache_alias is None:
                  cache_alias = DEFAULT_CACHE_ALIAS
              if cache_timeout is not None:
keep keep keep add keep keep keep keep keep
 Beefed up the tests for multi-cache handling of the cache middleware and view decorators, and made a couple of tweaks for edge cases as a result.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15021 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/middleware/cache.py