Skip to content

Commit e5f0e7a

Browse files
committed
Fix too strict typing of view functions in decorators
View functions can have additional parameters if the URL has parameters. Currently these are not allowed by the typing even though the code itself handles them just fine. Expand the view type to match what django-stubs is using e.g. here: https://github.com/typeddjango/django-stubs/blob/fb310b1b0b40c666c156f0943804f3791ff48f95/django-stubs/urls/conf.pyi#L18
1 parent c6ed796 commit e5f0e7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

csp/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from typing import TYPE_CHECKING, Any, Callable
55

66
if TYPE_CHECKING:
7-
from django.http import HttpRequest, HttpResponseBase
7+
from django.http import HttpResponseBase
88

99
# A generic Django view function
10-
_VIEW_T = Callable[[HttpRequest], HttpResponseBase]
10+
_VIEW_T = Callable[..., HttpResponseBase]
1111
_VIEW_DECORATOR_T = Callable[[_VIEW_T], _VIEW_T]
1212

1313

0 commit comments

Comments
 (0)