Ticket #10016: 10016-cache-middleware-handle-long-urls.diff
File 10016-cache-middleware-handle-long-urls.diff, 1.7 KB (added by , 16 years ago) |
---|
-
django/utils/cache.py
143 143 value = request.META.get(header, None) 144 144 if value is not None: 145 145 ctx.update(value) 146 path = md5_constructor() 147 path.update(iri_to_uri(request.path)) 146 148 return 'views.decorators.cache.cache_page.%s.%s.%s' % ( 147 key_prefix, iri_to_uri(request.path), ctx.hexdigest())149 key_prefix, path.hexdigest(), ctx.hexdigest()) 148 150 149 151 def get_cache_key(request, key_prefix=None): 150 152 """ … … 158 160 """ 159 161 if key_prefix is None: 160 162 key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX 163 path = md5_constructor() 164 path.update(iri_to_uri(request.path)) 161 165 cache_key = 'views.decorators.cache.cache_header.%s.%s' % ( 162 key_prefix, iri_to_uri(request.path))166 key_prefix, path.hexdigest()) 163 167 headerlist = cache.get(cache_key, None) 164 168 if headerlist is not None: 165 169 return _generate_cache_key(request, headerlist, key_prefix) … … 183 187 key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX 184 188 if cache_timeout is None: 185 189 cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS 190 path = md5_constructor() 191 path.update(iri_to_uri(request.path)) 186 192 cache_key = 'views.decorators.cache.cache_header.%s.%s' % ( 187 key_prefix, iri_to_uri(request.path))193 key_prefix, path.hexdigest()) 188 194 if response.has_header('Vary'): 189 195 headerlist = ['HTTP_'+header.upper().replace('-', '_') 190 196 for header in cc_delim_re.split(response['Vary'])]