zulip/zerver
Alex Vandiver 8cfacbf8aa webhooks: Update comment about typing the webhook decorator.
The previous link was to "extended callable" types, which are
deprecated in favor of callback protocols.  Unfortunately, defining a
protocol class can't express the typing -- we need some sort of
variadic generics[1].  Specifically, we wish to support hitting the
endpoint with additional parameters; thus, this protocol is
insufficient:

```
class WebhookHandler(Protocol):
    def __call__(request: HttpRequest, api_key: str) -> HttpResponse: ...
```
...since it prohibits additional parameters.  And allowing extra
arguments:
```
class WebhookHandler(Protocol):
    def __call__(request: HttpRequest, api_key: str,
                 *args: object, **kwargs: object) -> HttpResponse: ...
```
...is similarly problematic, since the view handlers do not support
_arbitrary_ keyword arguments.

[1] https://github.com/python/typing/issues/193
2020-09-10 17:47:21 -07:00
..
data_import python: Use standard secrets module to generate random tokens. 2020-09-09 15:52:57 -07:00
lib webhooks: Rename UnexpectedWebhookEventType to UnsupportedWebhookEventType. 2020-09-10 17:47:21 -07:00
management python: Pre-fix a few spots for better Black formatting. 2020-09-03 17:51:09 -07:00
migrations python: Use standard secrets module to generate random tokens. 2020-09-09 15:52:57 -07:00
openapi python: Rewrite dict() as {}. 2020-09-02 11:15:41 -07:00
templatetags python: Replace list literal concatenation with * unpacking. 2020-09-02 11:15:41 -07:00
tests webhooks: Rename UnexpectedWebhookEventType to UnsupportedWebhookEventType. 2020-09-10 17:47:21 -07:00
tornado python: Pre-fix a few spots for better Black formatting. 2020-09-03 17:51:09 -07:00
views python: Use standard secrets module to generate random tokens. 2020-09-09 15:52:57 -07:00
webhooks webhooks: Rename UnexpectedWebhookEventType to UnsupportedWebhookEventType. 2020-09-10 17:47:21 -07:00
worker python: Prefer kwargs form of dict.update. 2020-09-03 17:51:09 -07:00
__init__.py
apps.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
context_processors.py exceptions: Raise InvalidSubdomainError when realm is invalid. 2020-09-03 10:45:14 -07:00
decorator.py webhooks: Update comment about typing the webhook decorator. 2020-09-10 17:47:21 -07:00
filters.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
forms.py middleware: Make HostDomain into a process_request, not process_response. 2020-08-11 10:37:55 -07:00
logging_handlers.py models: Force the translated role into a translated string. 2020-09-03 17:26:54 -07:00
middleware.py python: Pre-fix a few spots for better Black formatting. 2020-09-03 17:51:09 -07:00
models.py python: Use standard secrets module to generate random tokens. 2020-09-09 15:52:57 -07:00
signals.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00