mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -80,8 +80,17 @@ def patch_response_headers(response, cache_timeout=None):
|
||||
if not response.has_header('Expires'):
|
||||
expires = now + datetime.timedelta(0, cache_timeout)
|
||||
response['Expires'] = expires.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||
if cache_timeout < 0:
|
||||
cache_timeout = 0 # Can't have max-age negative
|
||||
patch_cache_control(response, max_age=cache_timeout)
|
||||
|
||||
def add_never_cache_headers(response):
|
||||
"""
|
||||
Add headers to a response to indicate that
|
||||
a page should never be cached.
|
||||
"""
|
||||
patch_response_headers(response, cache_timeout=-1)
|
||||
|
||||
def patch_vary_headers(response, newheaders):
|
||||
"""
|
||||
Adds (or updates) the "Vary" header in the given HttpResponse object.
|
||||
|
||||
Reference in New Issue
Block a user