zerver/decorator: Set request.client in api_key_only_webhook_view.

Previously, api_key_only_webhook_view passed 3 positional arguments
(request, user_profile, and client) into a function. However, most
of our other auth decorators only pass 2 positional arguments. For
the sake of consistency, we now make api_key_only_webhook_view set
request.client and pass only request and user_profile as positional
arguments.
This commit is contained in:
Eeshan Garg
2017-05-01 20:30:50 -02:30
committed by Tim Abbott
parent 2e0c03ae2d
commit e87e246fcb
46 changed files with 189 additions and 188 deletions

View File

@@ -355,15 +355,15 @@ target server for the webhook, and an API key.
If the webhook does not have an option to provide a bot email, use the
`api_key_only_webhook_view` decorator, to fill in the `user_profile` and
`client` fields of a request:
`request.client` fields of a request:
``` py
@api_key_only_webhook_view('PagerDuty')
@has_request_variables
def api_pagerduty_webhook(request, user_profile, client,
def api_pagerduty_webhook(request, user_profile,
payload=REQ(argument_type='body'),
stream=REQ(default='pagerduty'),
topic=REQ(default=None)):
```
The `client` will be the result of `get_client("ZulipPagerDutyWebhook")`
in this example.
`request.client` will be the result of `get_client("ZulipPagerDutyWebhook")`
in this example and it will be passed to `check_send_message`.