Skip to content

Commit cc3a7e2

Browse files
committed
Add a system check for WWW_AUTHENTICATE_BEHAVIOR setting
1 parent 8c23de2 commit cc3a7e2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

rest_framework/checks.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.core.checks import Tags, Warning, register
1+
from django.core.checks import Tags, Error, Warning, register
22

33

44
@register(Tags.compatibility)
@@ -19,3 +19,22 @@ def pagination_system_check(app_configs, **kwargs):
1919
)
2020
)
2121
return errors
22+
23+
24+
@register(Tags.compatibility)
25+
def www_authneticate_behavior_setting_check(app_configs, **kwargs):
26+
errors = []
27+
# WWW_AUTHENTICATE_BEHAVIOR setting must be 'first' or 'all'
28+
from rest_framework.settings import api_settings
29+
setting = api_settings.WWW_AUTHENTICATE_BEHAVIOR
30+
if setting not in ['first', 'all']:
31+
errors.append(
32+
Error(
33+
"The rest_framework setting WWW_AUTHENTICATE_BEHAVIOR must be either "
34+
f"'first' or 'all' (it is currently set to '{setting}').",
35+
hint="Set WWW_AUTHENTICATE_BEHAVIOR to either 'first' or 'all', "
36+
"or leave it unset (the default value is 'first').",
37+
id="rest_framework.E001",
38+
)
39+
)
40+
return errors

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy