Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions django/contrib/auth/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ async def auser(request):


class AuthenticationMiddleware(MiddlewareMixin):
async_capable = False

def process_request(self, request):
if not hasattr(request, "session"):
raise ImproperlyConfigured(
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/flatpages/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


class FlatpageFallbackMiddleware(MiddlewareMixin):
async_capable = False

def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a flatpage for non-404 responses.
Expand Down
4 changes: 0 additions & 4 deletions django/contrib/gis/gdal/libgdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
"gdal307",
"gdal306",
"gdal305",
"gdal304",
"gdal303",
]
elif os.name == "posix":
# *NIX library names.
Expand All @@ -48,8 +46,6 @@
"gdal3.7.0",
"gdal3.6.0",
"gdal3.5.0",
"gdal3.4.0",
"gdal3.3.0",
]
else:
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/gis/gdal/raster/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
9: "GDT_CInt32", # Complex Int32
10: "GDT_CFloat32", # Complex Float32
11: "GDT_CFloat64", # Complex Float64
12: "GDT_UInt64", # 64 bit unsigned integer (GDAL 3.5+).
13: "GDT_Int64", # 64 bit signed integer (GDAL 3.5+).
12: "GDT_UInt64", # 64 bit unsigned integer
13: "GDT_Int64", # 64 bit signed integer
14: "GDT_Int8", # 8 bit signed integer (GDAL 3.7+).
}

Expand Down
2 changes: 2 additions & 0 deletions django/contrib/messages/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class MessageMiddleware(MiddlewareMixin):
Middleware that handles temporary messages.
"""

async_capable = False

def process_request(self, request):
request._messages = default_storage(request)

Expand Down
2 changes: 2 additions & 0 deletions django/contrib/redirects/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class RedirectFallbackMiddleware(MiddlewareMixin):
async_capable = False

# Defined as class-level attributes to be subclassing-friendly.
response_gone_class = HttpResponseGone
response_redirect_class = HttpResponsePermanentRedirect
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/sessions/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@


class SessionMiddleware(MiddlewareMixin):
async_capable = False

def __init__(self, get_response):
super().__init__(get_response)
engine = import_module(settings.SESSION_ENGINE)
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/sites/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ class CurrentSiteMiddleware(MiddlewareMixin):
Middleware that sets `site` attribute to request object.
"""

async_capable = False

def process_request(self, request):
request.site = get_current_site(request)
4 changes: 4 additions & 0 deletions django/middleware/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class UpdateCacheMiddleware(MiddlewareMixin):
so that it'll get called last during the response phase.
"""

async_capable = False

def __init__(self, get_response):
super().__init__(get_response)
self.cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
Expand Down Expand Up @@ -153,6 +155,8 @@ class FetchFromCacheMiddleware(MiddlewareMixin):
so that it'll get called last during the request phase.
"""

async_capable = False

def __init__(self, get_response):
super().__init__(get_response)
self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
Expand Down
2 changes: 2 additions & 0 deletions django/middleware/clickjacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class XFrameOptionsMiddleware(MiddlewareMixin):
X_FRAME_OPTIONS in your project's Django settings to 'SAMEORIGIN'.
"""

async_capable = False

def process_response(self, request, response):
# Don't set it if it's already in the response
if response.get("X-Frame-Options") is not None:
Expand Down
2 changes: 2 additions & 0 deletions django/middleware/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CommonMiddleware(MiddlewareMixin):
overriding the response_redirect_class attribute.
"""

async_capable = False
response_redirect_class = HttpResponsePermanentRedirect

def process_request(self, request):
Expand Down Expand Up @@ -118,6 +119,7 @@ def process_response(self, request, response):


class BrokenLinkEmailsMiddleware(MiddlewareMixin):
async_capable = False
# Set to override the mail.mailers alias used for sending the email.
using = None

Expand Down
2 changes: 2 additions & 0 deletions django/middleware/csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def get_nonce(request):


class ContentSecurityPolicyMiddleware(MiddlewareMixin):
async_capable = False

def process_request(self, request):
request._csp_nonce = LazyNonce()

Expand Down
2 changes: 2 additions & 0 deletions django/middleware/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class CsrfViewMiddleware(MiddlewareMixin):
template tag.
"""

async_capable = False

@cached_property
def csrf_trusted_origins_hosts(self):
return [
Expand Down
1 change: 1 addition & 0 deletions django/middleware/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class GZipMiddleware(MiddlewareMixin):
on the Accept-Encoding header.
"""

async_capable = False
max_random_bytes = 100

def process_response(self, request, response):
Expand Down
2 changes: 2 additions & 0 deletions django/middleware/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class ConditionalGetMiddleware(MiddlewareMixin):
header if needed.
"""

async_capable = False

def process_response(self, request, response):
# It's too late to prevent an unsafe request with a 412 response, and
# for a HEAD request, the response body is always empty so computing
Expand Down
1 change: 1 addition & 0 deletions django/middleware/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class LocaleMiddleware(MiddlewareMixin):
the language the user desires (if the language is available).
"""

async_capable = False
response_redirect_class = HttpResponseRedirect

def process_request(self, request):
Expand Down
2 changes: 2 additions & 0 deletions django/middleware/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@


class SecurityMiddleware(MiddlewareMixin):
async_capable = False

def __init__(self, get_response):
super().__init__(get_response)
self.sts_seconds = settings.SECURE_HSTS_SECONDS
Expand Down
Loading
Loading