summaryrefslogtreecommitdiff
path: root/django/utils/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils/cache.py')
-rw-r--r--django/utils/cache.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py
index e74bfbea5d..8d0ce4dac5 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -22,10 +22,12 @@ import hashlib
import logging
import re
import time
+import warnings
from django.conf import settings
from django.core.cache import caches
from django.http import HttpResponse, HttpResponseNotModified
+from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.encoding import force_bytes, force_text, iri_to_uri
from django.utils.http import (
http_date, parse_etags, parse_http_date_safe, quote_etag,
@@ -242,6 +244,13 @@ def patch_response_headers(response, cache_timeout=None):
if cache_timeout < 0:
cache_timeout = 0 # Can't have max-age negative
if settings.USE_ETAGS and not response.has_header('ETag'):
+ warnings.warn(
+ "The USE_ETAGS setting is deprecated in favor of "
+ "ConditionalGetMiddleware which sets the ETag regardless of the "
+ "setting. patch_response_headers() won't do ETag processing in "
+ "Django 2.1.",
+ RemovedInDjango21Warning
+ )
if hasattr(response, 'render') and callable(response.render):
response.add_post_render_callback(set_response_etag)
else: