mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
register_output_renderer can now return Response, closes #953
This commit is contained in:
parent
86aefc39c5
commit
799ecae948
5 changed files with 42 additions and 16 deletions
|
|
@ -455,13 +455,17 @@ class DataView(BaseView):
|
|||
result = await result
|
||||
if result is None:
|
||||
raise NotFound("No data")
|
||||
|
||||
r = Response(
|
||||
body=result.get("body"),
|
||||
status=result.get("status_code", 200),
|
||||
content_type=result.get("content_type", "text/plain"),
|
||||
headers=result.get("headers"),
|
||||
)
|
||||
if isinstance(result, dict):
|
||||
r = Response(
|
||||
body=result.get("body"),
|
||||
status=result.get("status_code", 200),
|
||||
content_type=result.get("content_type", "text/plain"),
|
||||
headers=result.get("headers"),
|
||||
)
|
||||
elif isinstance(result, Response):
|
||||
r = result
|
||||
else:
|
||||
assert False, "{} should be dict or Response".format(result)
|
||||
else:
|
||||
extras = {}
|
||||
if callable(extra_template_data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue