MCPcopy
hub / github.com/django/django / check_middleware

Function check_middleware

django/contrib/auth/checks.py:239–261  ·  view source on GitHub ↗
(app_configs, **kwargs)

Source from the content-addressed store, hash-verified

237
238
239def check_middleware(app_configs, **kwargs):
240 errors = []
241
242 login_required_index = _subclass_index(
243 "django.contrib.auth.middleware.LoginRequiredMiddleware",
244 settings.MIDDLEWARE,
245 )
246
247 if login_required_index != -1:
248 auth_index = _subclass_index(
249 "django.contrib.auth.middleware.AuthenticationMiddleware",
250 settings.MIDDLEWARE,
251 )
252 if auth_index == -1 or auth_index > login_required_index:
253 errors.append(
254 checks.Error(
255 "In order to use django.contrib.auth.middleware."
256 "LoginRequiredMiddleware, django.contrib.auth.middleware."
257 "AuthenticationMiddleware must be defined before it in MIDDLEWARE.",
258 id="auth.E013",
259 )
260 )
261 return errors

Callers

nothing calls this directly

Calls 2

_subclass_indexFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected