Skip to content

Make original path available to render hooks #1179

@simonw

Description

@simonw

https://github.com/simonw/datasette-export-notebook/blob/0.1/datasette_export_notebook/__init__.py

async def render_notebook(datasette, request):
    return Response.html(
        await datasette.render_template(
            "export_notebook.html",
            {
                "csv_stream_url": datasette.absolute_url(
                    request,
                    path_with_format(
                        request=request, format="csv", extra_qs={"_stream": "on"}
                    ),
                ),
                "json_url": datasette.absolute_url(
                    request,
                    path_with_format(
                        request=request, format="json", extra_qs={"_shape": "array"}
                    ),
                ),
                "json": json,
            },
        )
    )

This results in https://latest-with-plugins.datasette.io/github/issue_comments.Notebook showing http://latest-with-plugins.datasette.io/github/issue_comments.Notebook?_format=json&_shape=array

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions