extra_template_vars() sending wrong view_name for index
See original GitHub issueSee https://github.com/simonw/museums/issues/20#issuecomment-609103663 - at some point between 286ed286b68793532c2a38436a08343b45cfbc91 and current master (e0e7a0facfc935a835cd73c720bc46661462f0b1 today) a bug was introduced where the extra_template_vars(request, view_name)
plugin hook started being passed None
instead of index
for the view_name
parameter on the site index page.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You start
git bisect
by giving it a known bad commit and a known good one:Then you tell it to start running your script:
Here’s what I got:
So 70b915fb4bc214f9d064179f87671f8a378aa127 introduced the bug!
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 thetmpdir
fixture I usually use isn’t compatible withscope="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 theQueryView
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.