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/716#issuecomment-609107679 | https://api.github.com/repos/simonw/datasette/issues/716 | 609107679 | MDEyOklzc3VlQ29tbWVudDYwOTEwNzY3OQ== | 9599 | 2020-04-05T00:10:37Z | 2020-04-05T00:11:06Z | OWNER | Once I fix this bug I should update https://github.com/simonw/museums to deploy using the latest Datasette release as opposed to being anchored to 286ed28. https://github.com/simonw/museums/blob/1bbed542617757e9e276a5098193d6288b7f421d/.github/workflows/push.yml#L61 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609109354 | https://api.github.com/repos/simonw/datasette/issues/716 | 609109354 | MDEyOklzc3VlQ29tbWVudDYwOTEwOTM1NA== | 9599 | 2020-04-05T00:30:30Z | 2020-04-05T00:31:55Z | OWNER | In order to use `git bisect run` I need to write a standalone script that can tell if the bug is present or not. I'm going to use something I can execute with `pytest`, inspired loosely by this code: https://github.com/simonw/datasette/blob/7656fd64d8b6a32ebc34d89c1b8711cc5ea240f7/tests/test_plugins.py#L205-L227 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/717#issuecomment-609111516 | https://api.github.com/repos/simonw/datasette/issues/717 | 609111516 | MDEyOklzc3VlQ29tbWVudDYwOTExMTUxNg== | 9599 | 2020-04-05T00:57:29Z | 2020-04-05T00:57:29Z | OWNER | If I can get this working I think I'll release it as a plugin, similar to [datasette-publish-fly](https://github.com/simonw/datasette-publish-fly). | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594189527 | |
https://github.com/simonw/datasette/issues/717#issuecomment-609306846 | https://api.github.com/repos/simonw/datasette/issues/717 | 609306846 | MDEyOklzc3VlQ29tbWVudDYwOTMwNjg0Ng== | 9599 | 2020-04-05T04:18:48Z | 2020-04-05T04:18:48Z | OWNER | I need to route all paths to the same function. This should help: https://twitter.com/aboodman/status/1246605658067066882 ![image](https://user-images.githubusercontent.com/9599/78466750-d4d55700-76b9-11ea-8fac-cfa674b9785b.png) | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594189527 | |
https://github.com/simonw/datasette/pull/627#issuecomment-609393513 | https://api.github.com/repos/simonw/datasette/issues/627 | 609393513 | MDEyOklzc3VlQ29tbWVudDYwOTM5MzUxMw== | 4312421 | 2020-04-05T10:23:57Z | 2020-04-05T10:23:57Z | NONE | is there any specific reason to stick to Jinja2~=2.10.3 when there is Jinja-2.11.1 ? | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
521323012 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609453886 | https://api.github.com/repos/simonw/datasette/issues/716 | 609453886 | MDEyOklzc3VlQ29tbWVudDYwOTQ1Mzg4Ng== | 9599 | 2020-04-05T17:38:38Z | 2020-04-05T17:42:14Z | OWNER | OK, here's the test harness. Three files: `check_view_name.py` ```python import asyncio import pathlib from datasette.app import Datasette import httpx root = pathlib.Path(__file__).parent async def run_check(): ds = Datasette( [], template_dir=str(root / "templates"), plugins_dir=str(root / "plugins") ) async with httpx.AsyncClient(app=ds.app()) as client: response = await client.get("http://localhost/") assert 200 == response.status_code assert b"view_name:index" == response.content, response.content if __name__ == "__main__": loop = asyncio.get_event_loop() loop.run_until_complete(run_check()) ``` `templates/index.html` ``` view_name:{{ view_name }} ``` `plugins/extra_vars.py` ```python from datasette import hookimpl @hookimpl def extra_template_vars(view_name): return {"view_name": view_name} ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609454072 | https://api.github.com/repos/simonw/datasette/issues/716 | 609454072 | MDEyOklzc3VlQ29tbWVudDYwOTQ1NDA3Mg== | 9599 | 2020-04-05T17:39:47Z | 2020-04-05T17:39:47Z | OWNER | `python check_view_name.py` against 286ed28 exits cleanly. `python check_view_name.py` against current master (e0e7a0fa) fails: ``` $ python check_view_name.py Traceback (most recent call last): File "check_view_name.py", line 16, in <module> loop.run_until_complete(run_check()) File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete return future.result() File "check_view_name.py", line 11, in run_check assert b"view_name:index" == response.content, response.content AssertionError: b'view_name:None' ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609455243 | https://api.github.com/repos/simonw/datasette/issues/716 | 609455243 | MDEyOklzc3VlQ29tbWVudDYwOTQ1NTI0Mw== | 9599 | 2020-04-05T17:47:33Z | 2020-04-05T17:47:33Z | OWNER | You start `git bisect` by giving it a known bad commit and a known good one: ``` git bisect start master 286ed28 ``` Then you tell it to start running your script: ``` git bisect run python ../datasette-issue-716/check_view_name.py ``` Here's what I got: ``` (datasette) ~/Dropbox/Development/datasette $ git bisect start master 286ed28 Bisecting: 30 revisions left to test after this (roughly 5 steps) [dc80e779a2e708b2685fc641df99e6aae9ad6f97] Handle scope path if it is a string (datasette) ~/Dropbox/Development/datasette $ git bisect run python ../datasette-issue-716/check_view_name.py running python ../datasette-issue-716/check_view_name.py Traceback (most recent call last): ... Bisecting: 15 revisions left to test after this (roughly 4 steps) [7c6a9c35299f251f9abfb03fd8e85143e4361709] Better tests for prepare_connection() plugin hook, refs #678 running python ../datasette-issue-716/check_view_name.py Traceback (most recent call last): ... Bisecting: 7 revisions left to test after this (roughly 3 steps) [0091dfe3e5a3db94af8881038d3f1b8312bb857d] More reliable tie-break ordering for facet results running python ../datasette-issue-716/check_view_name.py Traceback (most recent call last): ... Bisecting: 3 revisions left to test after this (roughly 2 steps) [ce12244037b60ba0202c814871218c1dab38d729] Release notes for 0.35 running python ../datasette-issue-716/check_view_name.py Traceback (most recent call last): ... Bisecting: 0 revisions left to test after this (roughly 1 step) [4d7dae9eb75e5430c3ee3c369bb5cd9ba0a148bc] Added a bunch more plugins to the Ecosystem page running python ../datasette-issue-716/check_view_name.py Traceback (most recent call last): ... 70b915fb4bc214f9d064179f87671f8a378aa127 is the first bad commit commit 70b915fb4bc214f9d064179f87671f8a378aa127 Author: Simon Willison <swillison@gmail.com> Date: Tue Feb 4 12:26:17 2020 -0800 Datasette.render_template() method, closes #577 Pull request #664. :040000 040000 def9e31252e056845609… | { "total_count": 1, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 1, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609456030 | https://api.github.com/repos/simonw/datasette/issues/716 | 609456030 | MDEyOklzc3VlQ29tbWVudDYwOTQ1NjAzMA== | 9599 | 2020-04-05T17:52:39Z | 2020-04-05T20:02:13Z | OWNER | Found it. Prior to that change I passed `view_name` to the callbacks like this: https://github.com/simonw/datasette/blob/286ed286b68793532c2a38436a08343b45cfbc91/datasette/views/base.py#L114-L132 I switched over to doing this: https://github.com/simonw/datasette/blob/07e208cc6d9e901b87552c1be2854c220b3f9b6d/datasette/views/base.py#L95-L97 But forgot to pass in the optional `view_name=` argument to that `render_template()` method: https://github.com/simonw/datasette/blob/2aaad72789c427875426673c1a43e67c86fc970e/datasette/app.py#L554-L556 Next step: write a failing test, then fix it. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/716#issuecomment-609461331 | https://api.github.com/repos/simonw/datasette/issues/716 | 609461331 | MDEyOklzc3VlQ29tbWVudDYwOTQ2MTMzMQ== | 9599 | 2020-04-05T18:31:32Z | 2020-04-05T20:04:08Z | OWNER | The test ended up being a bit fiddly - here it is: https://github.com/simonw/datasette/blob/09253817dea3c131553494f9b2eb9c03f94ae761/tests/test_plugins.py#L266-L317 I used `tmp_path_factory` here because the `tmpdir` fixture I usually use isn't compatible with `scope="session"`, and I wanted to only create those temporary plugins and templates directories once rather than create them for each run of the parametrized test function. In writing this I realized that the `name` on the `QueryView` class wasn't being used, because that class is currently just used for its `.data()` method: https://github.com/simonw/datasette/blob/09253817dea3c131553494f9b2eb9c03f94ae761/datasette/views/database.py#L27-L31 https://github.com/simonw/datasette/blob/07e208cc6d9e901b87552c1be2854c220b3f9b6d/datasette/views/table.py#L224-L227 So I removed the `name = "query"` line since it was misleading. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
594168758 | |
https://github.com/simonw/datasette/issues/693#issuecomment-609461623 | https://api.github.com/repos/simonw/datasette/issues/693 | 609461623 | MDEyOklzc3VlQ29tbWVudDYwOTQ2MTYyMw== | 9599 | 2020-04-05T18:33:46Z | 2020-04-05T18:33:46Z | OWNER | So I should move the `template_debug` and `_context` logic into the `render_template()` method. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
574043218 | |
https://github.com/simonw/datasette/issues/693#issuecomment-609466998 | https://api.github.com/repos/simonw/datasette/issues/693 | 609466998 | MDEyOklzc3VlQ29tbWVudDYwOTQ2Njk5OA== | 9599 | 2020-04-05T19:12:48Z | 2020-04-05T19:12:48Z | OWNER | Fixed. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
574043218 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609467523 | https://api.github.com/repos/simonw/datasette/issues/689 | 609467523 | MDEyOklzc3VlQ29tbWVudDYwOTQ2NzUyMw== | 9599 | 2020-04-05T19:16:13Z | 2020-04-05T19:16:13Z | OWNER | I'm going to debug this using `git bisect run` - the same technique I used in #716 - https://github.com/simonw/datasette/issues/716#issuecomment-609453886 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609467876 | https://api.github.com/repos/simonw/datasette/issues/689 | 609467876 | MDEyOklzc3VlQ29tbWVudDYwOTQ2Nzg3Ng== | 9599 | 2020-04-05T19:18:36Z | 2020-04-05T19:18:36Z | OWNER | Just need the one checking script to run with bisect this time: `check_templates_considered.py` ```python import asyncio import pathlib from datasette.app import Datasette import httpx async def run_check(): ds = Datasette([]) async with httpx.AsyncClient(app=ds.app()) as client: response = await client.get("http://localhost/") assert 200 == response.status_code assert "Templates considered" in response.text if __name__ == "__main__": loop = asyncio.get_event_loop() loop.run_until_complete(run_check()) ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609468180 | https://api.github.com/repos/simonw/datasette/issues/689 | 609468180 | MDEyOklzc3VlQ29tbWVudDYwOTQ2ODE4MA== | 9599 | 2020-04-05T19:20:33Z | 2020-04-05T19:20:33Z | OWNER | ``` git bisect start master 0.34 git bisect run python check_templates_considered.py ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609468485 | https://api.github.com/repos/simonw/datasette/issues/689 | 609468485 | MDEyOklzc3VlQ29tbWVudDYwOTQ2ODQ4NQ== | 9599 | 2020-04-05T19:22:31Z | 2020-04-05T19:22:31Z | OWNER | ``` $ git bisect start master 0.34 Bisecting: 32 revisions left to test after this (roughly 5 steps) [dc80e779a2e708b2685fc641df99e6aae9ad6f97] Handle scope path if it is a string $ git bisect run python check_templates_considered.py running python check_templates_considered.py Traceback (most recent call last): ... AssertionError Bisecting: 15 revisions left to test after this (roughly 4 steps) [7c6a9c35299f251f9abfb03fd8e85143e4361709] Better tests for prepare_connection() plugin hook, refs #678 running python check_templates_considered.py Traceback (most recent call last): ... AssertionError Bisecting: 7 revisions left to test after this (roughly 3 steps) [0091dfe3e5a3db94af8881038d3f1b8312bb857d] More reliable tie-break ordering for facet results running python check_templates_considered.py Traceback (most recent call last): ... AssertionError Bisecting: 3 revisions left to test after this (roughly 2 steps) [ce12244037b60ba0202c814871218c1dab38d729] Release notes for 0.35 running python check_templates_considered.py Traceback (most recent call last): ... AssertionError Bisecting: 1 revision left to test after this (roughly 1 step) [70b915fb4bc214f9d064179f87671f8a378aa127] Datasette.render_template() method, closes #577 running python check_templates_considered.py Traceback (most recent call last): ... AssertionError Bisecting: 0 revisions left to test after this (roughly 0 steps) [286ed286b68793532c2a38436a08343b45cfbc91] geojson-to-sqlite running python check_templates_considered.py 70b915fb4bc214f9d064179f87671f8a378aa127 is the first bad commit commit 70b915fb4bc214f9d064179f87671f8a378aa127 Author: Simon Willison <swillison@gmail.com> Date: Tue Feb 4 12:26:17 2020 -0800 Datasette.render_template() method, closes #577 Pull request #664. :040000 040000 def9e31252e056845609de36c66d4320dd0c47f8 da19b7f8c26d50a4c05e5a7f05220b968429725c M datasette bisect run success ``` It was 70b915fb4bc214f9d064179f87671f8a378aa127 - the same bad commit that c… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609469318 | https://api.github.com/repos/simonw/datasette/issues/689 | 609469318 | MDEyOklzc3VlQ29tbWVudDYwOTQ2OTMxOA== | 9599 | 2020-04-05T19:28:14Z | 2020-04-05T19:28:14Z | OWNER | Here's why: the `BaseView.render()` method is running `jinja_env.select_template()` now here: https://github.com/simonw/datasette/blob/e89b0ef2f9ae89eb3bde83b694f21452ea4858da/datasette/views/base.py#L75-L88 Which means this logic is always called with a template, not a list of strings: https://github.com/simonw/datasette/blob/e89b0ef2f9ae89eb3bde83b694f21452ea4858da/datasette/app.py#L555-L571 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 | |
https://github.com/simonw/datasette/issues/689#issuecomment-609469440 | https://api.github.com/repos/simonw/datasette/issues/689 | 609469440 | MDEyOklzc3VlQ29tbWVudDYwOTQ2OTQ0MA== | 9599 | 2020-04-05T19:28:59Z | 2020-04-05T19:28:59Z | OWNER | So I think the fix is to move the `"select_templates": select_templates` context setting bit to here instead: https://github.com/simonw/datasette/blob/e89b0ef2f9ae89eb3bde83b694f21452ea4858da/datasette/views/base.py#L75-L83 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
573583971 |