Made register_output_renderer callback optionally awaitable, closes #776

This commit is contained in:
Simon Willison 2020-05-27 19:43:30 -07:00
commit 57f48b8416
4 changed files with 17 additions and 6 deletions

View file

@ -403,6 +403,8 @@ class DataView(BaseView):
args=request.args,
data=data,
)
if asyncio.iscoroutine(result):
result = await result
if result is None:
raise NotFound("No data")