Ticket #16003: 16003.patch

File 16003.patch, 873 bytes (added by Peter van Kampen, 13 years ago)

A preliminary patch that fixes the issue in the admin. Needs more work for an alround solution. Also regression tests

  • django/utils/cache.py

     
    102102    if cache_timeout < 0:
    103103        cache_timeout = 0 # Can't have max-age negative
    104104    if settings.USE_ETAGS and not response.has_header('ETag'):
    105         response['ETag'] = '"%s"' % hashlib.md5(response.content).hexdigest()
     105        from django.template.response import SimpleTemplateResponse
     106        if isinstance(response, SimpleTemplateResponse):
     107            content = response.rendered_content
     108        else:
     109            content = response.content
     110        response['ETag'] = '"%s"' % hashlib.md5(content).hexdigest()
    106111    if not response.has_header('Last-Modified'):
    107112        response['Last-Modified'] = http_date()
    108113    if not response.has_header('Expires'):
Back to Top