{"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1068415072", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1068415072, "node_id": "IC_kwDOBm6k_c4_rrhg", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-15T20:02:36Z", "updated_at": "2022-03-15T20:02:36Z", "author_association": "OWNER", "body": "This is one of the worst bits - the `get_format()` method on the `DataView` base class actually modifies `args`, including removing keys! Really confusing: https://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L454-L482\r\n\r\nThen `BaseView` has some surprising responsibilities. It has a utility helper for checking multiple permissions at once:\r\n\r\nhttps://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L81-L105\r\n\r\nAnd its own render method that adds extra stuff to the template context and handles the rel: alternate header:\r\n\r\nhttps://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L131-L157\r\n\r\nThen `DataView` does all sorts of weird stuff - from handling database hashes (which I want to remove, see #647):\r\n\r\nhttps://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L206-L219\r\n\r\nTo streaming CSV responses: https://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L286-L308\r\n\r\nTo handling SQLite exceptions: https://github.com/simonw/datasette/blob/77a904fea14f743560af9cc668146339bdbbd0a9/datasette/views/base.py#L514-L526\r\n\r\nAnd a ton more. It' s a big mess.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1068417357", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1068417357, "node_id": "IC_kwDOBm6k_c4_rsFN", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-15T20:05:08Z", "updated_at": "2022-03-15T20:05:08Z", "author_association": "OWNER", "body": "`DataView` is used as the base class for:\r\n\r\n- `DatabaseView`\r\n- `DatabaseDownload` (just so the permissions checks can be called)\r\n- `QueryView` - which isn't routed to directly, it's called from `DatabaseView` if `?sql=` is available and `TableView` for canned queries\r\n- `RowTableShared` which is the base class for `TableView` and `RowView`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1068418619", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1068418619, "node_id": "IC_kwDOBm6k_c4_rsY7", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-15T20:06:19Z", "updated_at": "2022-03-15T20:06:19Z", "author_association": "OWNER", "body": "Also related:\r\n- #878\r\n- #1512\r\n- #1518 \r\n- #870 ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1073073599", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1073073599, "node_id": "IC_kwDOBm6k_c4_9c2_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-19T20:06:40Z", "updated_at": "2022-03-19T20:06:40Z", "author_association": "OWNER", "body": "This blocks:\r\n- #1668", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1073355032", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1073355032, "node_id": "IC_kwDOBm6k_c4_-hkY", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-20T21:46:43Z", "updated_at": "2022-03-20T21:46:43Z", "author_association": "OWNER", "body": "I think the way to get rid of most of the remaining complexity in `DataView` is to refactor how CSV stuff works - pulling it in line with other export factors and extracting the streaming mechanism. Opening a fresh issue for that.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1074136176", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1074136176, "node_id": "IC_kwDOBm6k_c5ABgRw", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T16:38:46Z", "updated_at": "2022-03-21T16:38:46Z", "author_association": "OWNER", "body": "I'm going to refactor this stuff out and document it so it can be easily used by plugins:\r\n\r\nhttps://github.com/simonw/datasette/blob/4a4164b81191dec35e423486a208b05a9edc65e4/datasette/views/base.py#L69-L103", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1074287177", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1074287177, "node_id": "IC_kwDOBm6k_c5ACFJJ", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T18:51:42Z", "updated_at": "2022-03-21T18:51:42Z", "author_association": "OWNER", "body": "`BaseView` is looking a LOT slimmer now that I've moved all of the permissions stuff out of it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1660#issuecomment-1074321862", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1660", "id": 1074321862, "node_id": "IC_kwDOBm6k_c5ACNnG", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T19:19:01Z", "updated_at": "2022-03-21T19:19:01Z", "author_association": "OWNER", "body": "I've simplified this a ton now. I'm going to keep working on this in the long-term but I think this issue can be closed.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1170144879, "label": "Refactor and simplify Datasette routing and views"}, "performed_via_github_app": null}