------------------------------------------------------------------------------
To reply, visit https://hellosplat.com/s/beanbag/tickets/4723/
------------------------------------------------------------------------------
New update by jcannon
For Beanbag, Inc. > Djblets > Ticket #4723
Reply:
`decorators.py` is `djblets/webapi/decorators.py` and is just the relvant
djblits module.
Example is:
```python
class MyResource(WebAPIResource):
# ...
@webapi_response_errors(INVALID_FORM_DATA)
@webapi_request_fields(...)
def create(self, data1, data2):
data1 = self._helper(data1)
data2 = self._helper(data2)
return 201, {...}
def _helper(self, data):
if 'my_key' not in data:
# I can't return the error here, or else the caller would
# need to check for it.
# It would be nice if I could raise ResponseError(INVALID, ...)
# Or even better, rase InvalidFormData(...)
error()
return {...}
```
--
You received this message because you are subscribed to the Google Groups
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.