Skip to content

Commit 47e021e

Browse files
committed
Update types for CSP policies based on docs
1 parent 00b8f29 commit 47e021e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

django-stubs/conf/global_settings.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from collections.abc import Sequence
1+
from collections.abc import Collection, Mapping, Sequence
22
from re import Pattern
33

44
# This is defined here as a do-nothing function because we can't import
@@ -545,5 +545,5 @@ SECURE_SSL_REDIRECT: bool
545545
##################
546546
# CSP MIDDLEWARE #
547547
##################
548-
SECURE_CSP: dict[str, Sequence[str] | str]
549-
SECURE_CSP_REPORT_ONLY: dict[str, Sequence[str] | str]
548+
SECURE_CSP: Mapping[str, Collection[str] | str]
549+
SECURE_CSP_REPORT_ONLY: Mapping[str, Collection[str] | str]

django-stubs/utils/csp.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from collections.abc import Sequence
2+
from collections.abc import Collection, Mapping
33

44
from django.utils.functional import SimpleLazyObject
55

@@ -30,4 +30,4 @@ class LazyNonce(SimpleLazyObject):
3030
def __init__(self) -> None: ...
3131
def __bool__(self) -> bool: ...
3232

33-
def build_policy(config: dict[str, Sequence[str] | str], nonce: SimpleLazyObject | str | None = None) -> str: ...
33+
def build_policy(config: Mapping[str, Collection[str] | str], nonce: SimpleLazyObject | str | None = None) -> str: ...
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from collections.abc import Callable, Sequence
1+
from collections.abc import Callable, Collection, Mapping
22
from typing import Any, TypeVar
33

44
_F = TypeVar("_F", bound=Callable[..., Any])
55

6-
def csp_override(config: dict[str, Sequence[str] | str]) -> Callable[[_F], _F]: ...
7-
def csp_report_only_override(config: dict[str, Sequence[str] | str]) -> Callable[[_F], _F]: ...
6+
def csp_override(config: Mapping[str, Collection[str] | str]) -> Callable[[_F], _F]: ...
7+
def csp_report_only_override(config: Mapping[str, Collection[str] | str]) -> Callable[[_F], _F]: ...

0 commit comments

Comments
 (0)