diff --git a/datasette/views/database.py b/datasette/views/database.py index c5b59dd274..6d6821bddc 100644 --- a/datasette/views/database.py +++ b/datasette/views/database.py @@ -167,7 +167,12 @@ async def database_actions(): ], } return Response.html( - await datasette.render_template(templates, context, request=request), + await datasette.render_template( + templates, + context, + request=request, + view_name="database", + ), headers={ "Link": '{}; rel="alternate"; type="application/json+datasette"'.format( alternate_url_json @@ -470,8 +475,7 @@ async def fetch_data_for_csv(request, _next=None): database=database, table=data.get("table"), request=request, - # TODO: Fix this - view_name=None, + view_name="database", ) it_can_render = await await_me_maybe(it_can_render) if it_can_render: @@ -543,6 +547,7 @@ async def fetch_data_for_csv(request, _next=None): alternate_url_json=alternate_url_json, ), request=request, + view_name="database", ), headers=headers, ) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 6971bbf739..28fe720fa5 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -121,9 +121,8 @@ async def test_hook_extra_css_urls(ds_client, path, expected_decoded_object): ][0]["href"] # This link has a base64-encoded JSON blob in it encoded = special_href.split("/")[3] - assert expected_decoded_object == json.loads( - base64.b64decode(encoded).decode("utf8") - ) + actual_decoded_object = json.loads(base64.b64decode(encoded).decode("utf8")) + assert expected_decoded_object == actual_decoded_object @pytest.mark.asyncio