github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/1238#issuecomment-786849095 | https://api.github.com/repos/simonw/datasette/issues/1238 | 786849095 | MDEyOklzc3VlQ29tbWVudDc4Njg0OTA5NQ== | 9599 | 2021-02-26T19:29:38Z | 2021-02-26T19:29:38Z | OWNER | Here's the test I wrote: ```diff git diff tests/test_custom_pages.py diff --git a/tests/test_custom_pages.py b/tests/test_custom_pages.py index 6a23192..5a71f56 100644 --- a/tests/test_custom_pages.py +++ b/tests/test_custom_pages.py @@ -2,11 +2,19 @@ import pathlib import pytest from .fixtures import make_app_client +TEST_TEMPLATE_DIRS = str(pathlib.Path(__file__).parent / "test_templates") + @pytest.fixture(scope="session") def custom_pages_client(): + with make_app_client(template_dir=TEST_TEMPLATE_DIRS) as client: + yield client + + +@pytest.fixture(scope="session") +def custom_pages_client_with_base_url(): with make_app_client( - template_dir=str(pathlib.Path(__file__).parent / "test_templates") + template_dir=TEST_TEMPLATE_DIRS, config={"base_url": "/prefix/"} ) as client: yield client @@ -23,6 +31,12 @@ def test_request_is_available(custom_pages_client): assert "path:/request" == response.text +def test_custom_pages_with_base_url(custom_pages_client_with_base_url): + response = custom_pages_client_with_base_url.get("/prefix/request") + assert 200 == response.status + assert "path:/prefix/request" == response.text + + def test_custom_pages_nested(custom_pages_client): response = custom_pages_client.get("/nested/nest") assert 200 == response.status ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1238#issuecomment-786848654 | https://api.github.com/repos/simonw/datasette/issues/1238 | 786848654 | MDEyOklzc3VlQ29tbWVudDc4Njg0ODY1NA== | 9599 | 2021-02-26T19:28:48Z | 2021-02-26T19:28:48Z | OWNER | I added a debug line just before `for regex, wildcard_template` here: https://github.com/simonw/datasette/blob/afed51b1e36cf275c39e71c7cb262d6c5bdbaa31/datasette/app.py#L1148-L1155 And it showed that for some reason `request.path` is `/prefix/prefix/request` here - the prefix got doubled somehow. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1238#issuecomment-786841261 | https://api.github.com/repos/simonw/datasette/issues/1238 | 786841261 | MDEyOklzc3VlQ29tbWVudDc4Njg0MTI2MQ== | 9599 | 2021-02-26T19:13:44Z | 2021-02-26T19:13:44Z | OWNER | Sounds like a bug - thanks for reporting this. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1246#issuecomment-786840734 | https://api.github.com/repos/simonw/datasette/issues/1246 | 786840734 | MDEyOklzc3VlQ29tbWVudDc4Njg0MDczNA== | 9599 | 2021-02-26T19:12:39Z | 2021-02-26T19:12:47Z | OWNER | Could I take this part: ```python suggested_facet_sql = """ select distinct json_type({column}) from ({sql}) """.format( column=escape_sqlite(column), sql=self.sql ) ``` And add `where {column} is not null and {column} != ''` perhaps? | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
817597268 | |
https://github.com/simonw/datasette/issues/1246#issuecomment-786840425 | https://api.github.com/repos/simonw/datasette/issues/1246 | 786840425 | MDEyOklzc3VlQ29tbWVudDc4Njg0MDQyNQ== | 9599 | 2021-02-26T19:11:56Z | 2021-02-26T19:11:56Z | OWNER | Relevant code: https://github.com/simonw/datasette/blob/afed51b1e36cf275c39e71c7cb262d6c5bdbaa31/datasette/facets.py#L271-L295 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
817597268 | |
https://github.com/simonw/sqlite-utils/issues/239#issuecomment-786830832 | https://api.github.com/repos/simonw/sqlite-utils/issues/239 | 786830832 | MDEyOklzc3VlQ29tbWVudDc4NjgzMDgzMg== | 9599 | 2021-02-26T18:52:40Z | 2021-02-26T18:52:40Z | OWNER | Could this handle lists of objects too? That would be pretty amazing - if the column has a `[{...}, {...}]` list in it could turn that into a many-to-many. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
816526538 | |
https://github.com/simonw/datasette/issues/1240#issuecomment-786813506 | https://api.github.com/repos/simonw/datasette/issues/1240 | 786813506 | MDEyOklzc3VlQ29tbWVudDc4NjgxMzUwNg== | 9599 | 2021-02-26T18:19:46Z | 2021-02-26T18:19:46Z | OWNER | Linking to rows from custom queries is a lot harder - because given an arbitrary string of SQL it's difficult to analyze it and figure out which (if any) of the returned columns represent a primary key. It's possible to manually write a SQL query that returns a column that will be treated as a link to another page using this plugin, but it's not particularly straight-forward: https://datasette.io/plugins/datasette-json-html | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
814591962 | |
https://github.com/simonw/datasette/issues/1240#issuecomment-786812716 | https://api.github.com/repos/simonw/datasette/issues/1240 | 786812716 | MDEyOklzc3VlQ29tbWVudDc4NjgxMjcxNg== | 9599 | 2021-02-26T18:18:18Z | 2021-02-26T18:18:18Z | OWNER | Agreed, this would be extremely useful. I'd love to be able to facet against custom queries. It's a fair bit of work to implement but it's not impossible. Closing this as a duplicate of #972. | { "total_count": 1, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 1, "rocket": 0, "eyes": 0 } |
814591962 | |
https://github.com/simonw/sqlite-utils/issues/239#issuecomment-786795132 | https://api.github.com/repos/simonw/sqlite-utils/issues/239 | 786795132 | MDEyOklzc3VlQ29tbWVudDc4Njc5NTEzMg== | 9599 | 2021-02-26T17:45:53Z | 2021-02-26T17:45:53Z | OWNER | If there's no primary key in the JSON could use the `hash_id` mechanism. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
816526538 | |
https://github.com/simonw/sqlite-utils/issues/239#issuecomment-786794435 | https://api.github.com/repos/simonw/sqlite-utils/issues/239 | 786794435 | MDEyOklzc3VlQ29tbWVudDc4Njc5NDQzNQ== | 9599 | 2021-02-26T17:44:38Z | 2021-02-26T17:44:38Z | OWNER | This came up in office hours! | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
816526538 | |
https://github.com/simonw/datasette/issues/1244#issuecomment-786786645 | https://api.github.com/repos/simonw/datasette/issues/1244 | 786786645 | MDEyOklzc3VlQ29tbWVudDc4Njc4NjY0NQ== | 9599 | 2021-02-26T17:30:38Z | 2021-02-26T17:30:38Z | OWNER | New paragraph at the top of https://docs.datasette.io/en/latest/writing_plugins.html > Want to start by looking at an example? The [Datasette plugins directory](https://datasette.io/plugins) lists more than 50 open source plugins with code you can explore. The [plugin hooks](https://docs.datasette.io/en/latest/plugin_hooks.html#plugin-hooks) page includes links to example plugins for each of the documented hooks. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
817528452 |