{"html_url": "https://github.com/simonw/datasette/issues/842#issuecomment-650678951", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/842", "id": 650678951, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDY3ODk1MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T02:59:52Z", "updated_at": "2020-06-28T02:59:52Z", "author_association": "OWNER", "body": "Documentation: https://datasette.readthedocs.io/en/latest/sql_queries.html#magic-parameters\r\n\r\nPlugin hook documentation: https://datasette.readthedocs.io/en/latest/plugin_hooks.html#plugin-hook-register-magic-parameters", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 638212085, "label": "Magic parameters for canned queries"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/842#issuecomment-650679100", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/842", "id": 650679100, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDY3OTEwMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T03:00:44Z", "updated_at": "2020-06-28T03:00:44Z", "author_association": "OWNER", "body": "I'm going to add some canned queries to the `metadata.json` used by the live demo that illustrate this feature.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 638212085, "label": "Magic parameters for canned queries"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/805#issuecomment-650681496", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/805", "id": 650681496, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDY4MTQ5Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T03:11:51Z", "updated_at": "2020-06-28T03:11:51Z", "author_association": "OWNER", "body": "I can use magic parameters from #842 in this.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 632724154, "label": "Writable canned queries live demo on Glitch"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/842#issuecomment-650684635", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/842", "id": 650684635, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDY4NDYzNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T03:30:31Z", "updated_at": "2020-06-28T03:30:31Z", "author_association": "OWNER", "body": "Live demo: https://latest.datasette.io/fixtures/magic_parameters", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 638212085, "label": "Magic parameters for canned queries"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650696054", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650696054, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDY5NjA1NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T04:52:41Z", "updated_at": "2022-03-15T20:07:17Z", "author_association": "OWNER", "body": "This would be a lot easier if I had extracted out the hash logic to a plugin, see:\r\n- #647", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/805#issuecomment-650784162", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/805", "id": 650784162, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDc4NDE2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T15:48:32Z", "updated_at": "2020-06-28T15:48:32Z", "author_association": "OWNER", "body": "https://github.com/simonw/datasette-glitch is my new plugin that outputs the root login link on Glitch when the server starts.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 632724154, "label": "Writable canned queries live demo on Glitch"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/834#issuecomment-650811919", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/834", "id": 650811919, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxMTkxOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T19:38:50Z", "updated_at": "2020-06-28T19:38:50Z", "author_association": "OWNER", "body": "I have two plugins in progress that use this hook now:\r\n\r\n- https://github.com/simonw/datasette-init creates tables and views on startup\r\n- https://github.com/simonw/datasette-glitch outputs the login-as-root secret link on Glitch", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 637342551, "label": "startup() plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/871#issuecomment-650812444", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/871", "id": 650812444, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxMjQ0NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T19:43:27Z", "updated_at": "2020-06-28T19:43:27Z", "author_association": "OWNER", "body": "Currently:\r\n\r\n> `_timestamp_epoch`\r\n> \r\n> The number of seconds since the Unix epoch.\r\n> \r\n> `_timestamp_date_utc`\r\n> \r\n> The date in UTC, e.g. `2020-06-01`\r\n> \r\n> `_timestamp_datetime_utc`\r\n> \r\n> The ISO 8601 datetime in UTC, e.g. `2020-06-24T18:01:07Z`\r\n\r\nI'm going to rename them to:\r\n\r\n- `_now_epoch`\r\n- `_now_date_utc`\r\n- `_now_datetime_utc`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646840273, "label": "Rename the _timestamp magic parameters to _now"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650815278", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650815278, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxNTI3OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T20:09:07Z", "updated_at": "2020-06-28T20:11:21Z", "author_association": "OWNER", "body": "There's a lot of complex logic in the `DataView` class, which handles conditionally returning content as `.json` or as HTML or as `.csv`.\r\n\r\nThat view subclasses `AsgiView` which is itself request-aware, so maybe I don't need to reconsider how those classes work - just figure out how to hook them up with `register_routes`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650818086", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650818086, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxODA4Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T20:34:33Z", "updated_at": "2020-06-28T20:34:33Z", "author_association": "OWNER", "body": "The key to all of this may be the `DatasetteRouter` class. It deals with `scope` right now but if it internally dealt with `request` that could be enough to fix #864 by adding logic needed by the `.add_message()` mechanism.\r\n\r\nhttps://github.com/simonw/datasette/blob/0991ea75cc7b265389aa8362414a305ba532d31a/datasette/app.py#L904-L938", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650818309", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650818309, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxODMwOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T20:36:28Z", "updated_at": "2020-06-28T20:36:52Z", "author_association": "OWNER", "body": "Since `AsgiRouter` is only used as the super-class of the `DatasetteRouter` class maybe I should get rid of `AsgiRouter` entirely - no point in having a Datasette-specific subclass of it if the parent class isn't ever used by anything else.\r\n\r\nI could also rename it to just `Router` which is a nicer name than `DatasetteRouter`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/847#issuecomment-650819895", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/847", "id": 650819895, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgxOTg5NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T20:50:21Z", "updated_at": "2020-06-28T20:50:21Z", "author_association": "OWNER", "body": "I'm happy enough with https://codecov.io/gh/simonw/datasette that I'm not going to spend any more time on this.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 638259643, "label": "Take advantage of .coverage being a SQLite database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650820068", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650820068, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgyMDA2OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T20:52:09Z", "updated_at": "2020-06-28T20:53:00Z", "author_association": "OWNER", "body": "Maybe I could add a `as_request_view` method as an alternative to `as_asgi`:\r\n\r\nhttps://github.com/simonw/datasette/blob/a8bcafc1775c8a8655b365ae22a3d64f6361c74a/datasette/utils/asgi.py#L150-L174\r\n\r\nOr I could teach the `Router` to spot the `dispatch_request` method and call it directly.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650834251", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650834251, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgzNDI1MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T23:03:28Z", "updated_at": "2020-06-28T23:03:28Z", "author_association": "OWNER", "body": "I'm going to ditch that `AsgiView` class too, by combining it into `BaseView`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650834666", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650834666, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgzNDY2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T23:07:19Z", "updated_at": "2020-06-28T23:07:19Z", "author_association": "OWNER", "body": "So now the problem is simpler: I need to get `BaseView` to a state where it can accept a shared `request` object and it can be used in conjunction with `register_routes()`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650838691", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650838691, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgzODY5MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T23:44:12Z", "updated_at": "2020-06-28T23:44:25Z", "author_association": "OWNER", "body": "This code is interesting:\r\n\r\nhttps://github.com/simonw/datasette/blob/3bc2461c77ecba3e1a95301dd440a9bef56b1283/datasette/app.py#L948-L955\r\n\r\nI want to change the signature of that `return await view(new_scope, receive, send)` method to instead take `(request, send)` - so I can have a single shared request object that's created just once per HTTP request.\r\n\r\nThe problem is the scope modification: I have code that modifies the scope, but how should that impact a shared `Request` instance? Should its `.scope` be replaced with alternative scopes as it travels through the codebase?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/870#issuecomment-650838972", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/870", "id": 650838972, "node_id": "MDEyOklzc3VlQ29tbWVudDY1MDgzODk3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-28T23:46:40Z", "updated_at": "2020-06-28T23:46:40Z", "author_association": "OWNER", "body": "I'm going to create the single `Request()` instance in the `DatasetteRouter` class - at the beginning of the `route_path` method: https://github.com/simonw/datasette/blob/3bc2461c77ecba3e1a95301dd440a9bef56b1283/datasette/app.py#L905-L925", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 646737558, "label": "Refactor default views to use register_routes"}, "performed_via_github_app": null}