Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/django/core/checks/compatibility/django_4_0.py: 85%

9 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1from django.conf import settings 

2 

3from .. import Error, Tags, register 

4 

5 

6@register(Tags.compatibility) 

7def check_csrf_trusted_origins(app_configs, **kwargs): 

8 errors = [] 

9 for origin in settings.CSRF_TRUSTED_ORIGINS: 

10 if "://" not in origin: 10 ↛ 11line 10 didn't jump to line 11, because the condition on line 10 was never true

11 errors.append( 

12 Error( 

13 "As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS " 

14 "setting must start with a scheme (usually http:// or " 

15 "https://) but found %s. See the release notes for details." 

16 % origin, 

17 id="4_0.E001", 

18 ) 

19 ) 

20 return errors