issues: 645975649

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association pull_request body repo type active_lock_reason
645975649 MDU6SXNzdWU2NDU5NzU2NDk= 867 register_routes() should support non-async view functions too 9599 closed 0   5533512 1 2020-06-26T03:11:25Z 2020-06-27T18:30:41Z 2020-06-27T18:30:40Z OWNER  

I was looking at this: https://github.com/simonw/datasette-block-robots/blob/main/datasette_block_robots/init.py

from datasette import hookimpl
from datasette.utils.asgi import Response


async def robots_txt():
    return Response.text("User-agent: *\nDisallow: /")


@hookimpl
def register_routes():
    return [
        (r"^/robots\.txt$", robots_txt),
    ]

And I realized that if register_routes() could support non-async view functions it could be reduced to this:

@hookimpl
def register_routes():
    return [
        (r"^/robots\.txt$", lambda: Response.text("User-agent: *\nDisallow: /")),
    ]
107914493 issue  

Links from other tables

Powered by Datasette · Query took 1.233ms · About: github-to-sqlite