Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

webhooks: Update comment about typing the webhook decorator.

Alex Vandiver8cfacbf8aa55
diff --git a/zerver/decorator.py b/zerver/decorator.py
index 6cb5cf59db3..4e9e2a884d8 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -324,8 +324,9 @@ def api_key_only_webhook_view(
webhook_client_name: str,
notify_bot_owner_on_invalid_json: bool=True,
) -> Callable[[Callable[..., HttpResponse]], Callable[..., HttpResponse]]:
- # TODO The typing here could be improved by using the Extended Callable types:
- # https://mypy.readthedocs.io/en/latest/kinds_of_types.html#extended-callable-types
+ # Unfortunately, callback protocols are insufficient for this:
+ # https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols
+ # Variadic generics are necessary: https://github.com/python/typing/issues/193
def _wrapped_view_func(view_func: Callable[..., HttpResponse]) -> Callable[..., HttpResponse]:
@csrf_exempt
@has_request_variables