Allow exception_handler to pass kwargs to the wrapped function

This commit is contained in:
Gregoo 2025-01-24 10:27:06 +01:00
parent 4052ac00ad
commit 57d9f167a5

View File

@ -27,7 +27,8 @@ def exception_handler(
/, /,
*, *,
json: bool = False, json: bool = False,
post_redirect: str | None = None post_redirect: str | None = None,
**superkwargs,
) -> Callable[[ViewCallable], ViewCallable]: ) -> Callable[[ViewCallable], ViewCallable]:
def outer(function: ViewCallable, /) -> ViewCallable: def outer(function: ViewCallable, /) -> ViewCallable:
@wraps(function) @wraps(function)
@ -42,6 +43,7 @@ def exception_handler(
json=json, json=json,
post_redirect=post_redirect, post_redirect=post_redirect,
**kwargs, **kwargs,
**superkwargs,
) )
return wrapper return wrapper
return outer return outer