~kkubasik/django/aggregation-branch

« back to all changes in this revision

Viewing changes to django/utils/cache.py

  • Committer: adrian
  • Date: 2006-05-02 01:31:56 UTC
  • Revision ID: vcs-imports@canonical.com-20060502013156-2941fcd40d080649
MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
    if not response.has_header('Expires'):
81
81
        expires = now + datetime.timedelta(0, cache_timeout)
82
82
        response['Expires'] = expires.strftime('%a, %d %b %Y %H:%M:%S GMT')
 
83
    if cache_timeout < 0:
 
84
        cache_timeout = 0 # Can't have max-age negative
83
85
    patch_cache_control(response, max_age=cache_timeout)
84
86
 
 
87
def add_never_cache_headers(response):
 
88
    """
 
89
    Add headers to a response to indicate that 
 
90
    a page should never be cached.
 
91
    """
 
92
    patch_response_headers(response, cache_timeout=-1)
 
93
 
85
94
def patch_vary_headers(response, newheaders):
86
95
    """
87
96
    Adds (or updates) the "Vary" header in the given HttpResponse object.