forked from 00dani/lemoncurry
Introduce a middleware that allows for HttpResponses to be thrown from inner utility functions, to avoid boilerplate in views
This commit is contained in:
parent
1d4be082cf
commit
7d17a92793
4 changed files with 22 additions and 9 deletions
|
@ -17,8 +17,6 @@ def delete(request):
|
|||
return error.unsupported_type(request.content_type)
|
||||
url = normalise[request.content_type](request)
|
||||
entry = from_url(url)
|
||||
if isinstance(entry, HttpResponse):
|
||||
return entry
|
||||
|
||||
if entry.author != request.token.user:
|
||||
return error.forbid('entry belongs to another user')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue