diff options
| author | django-bot <ops@djangoproject.com> | 2025-07-22 20:41:41 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 69a93a88edb56ba47f624dac7a21aacc47ea474f (patch) | |
| tree | f57507a4435d032493cae40e06ecb254790b67b2 /django/middleware | |
| parent | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff) | |
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'django/middleware')
| -rw-r--r-- | django/middleware/cache.py | 7 | ||||
| -rw-r--r-- | django/middleware/csrf.py | 3 | ||||
| -rw-r--r-- | django/middleware/http.py | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/django/middleware/cache.py b/django/middleware/cache.py index df26def6b4..10fff365af 100644 --- a/django/middleware/cache.py +++ b/django/middleware/cache.py @@ -29,8 +29,8 @@ More details about how the caching works: of the response's "Cache-Control" header, falling back to the CACHE_MIDDLEWARE_SECONDS setting if the section was not found. -* This middleware expects that a HEAD request is answered with the same response - headers exactly like the corresponding GET request. +* This middleware expects that a HEAD request is answered with the same + response headers exactly like the corresponding GET request. * When a hit occurs, a shallow copy of the original response object is returned from process_request. @@ -163,7 +163,8 @@ class FetchFromCacheMiddleware(MiddlewareMixin): request._cache_update_cache = True return None # No cache information available, need to rebuild. response = self.cache.get(cache_key) - # if it wasn't found and we are looking for a HEAD, try looking just for that + # if it wasn't found and we are looking for a HEAD, try looking just + # for that if response is None and request.method == "HEAD": cache_key = get_cache_key( request, self.key_prefix, "HEAD", cache=self.cache diff --git a/django/middleware/csrf.py b/django/middleware/csrf.py index 2e4b30ed54..c2800cfad4 100644 --- a/django/middleware/csrf.py +++ b/django/middleware/csrf.py @@ -420,7 +420,8 @@ class CsrfViewMiddleware(MiddlewareMixin): if getattr(callback, "csrf_exempt", False): return None - # Assume that anything not defined as 'safe' by RFC 9110 needs protection + # Assume that anything not defined as 'safe' by RFC 9110 needs + # protection if request.method in ("GET", "HEAD", "OPTIONS", "TRACE"): return self._accept(request) diff --git a/django/middleware/http.py b/django/middleware/http.py index 84c5466bb6..72ef52a126 100644 --- a/django/middleware/http.py +++ b/django/middleware/http.py @@ -6,8 +6,9 @@ from django.utils.http import parse_http_date_safe class ConditionalGetMiddleware(MiddlewareMixin): """ Handle conditional GET operations. If the response has an ETag or - Last-Modified header and the request has If-None-Match or If-Modified-Since, - replace the response with HttpNotModified. Add an ETag header if needed. + Last-Modified header and the request has If-None-Match or + If-Modified-Since, replace the response with HttpNotModified. Add an ETag + header if needed. """ def process_response(self, request, response): |
