Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
I would like is the ability for renderers to opt-in / opt-out of being displayed as options on the page.
https://www.niche-museums.com/browse/museums for example shows a atom link because the datasette-atom plugin is installed... but clicking it will give you a 400 error because the correct columns are not present.
Here's the code that passes a list of renderers to the template:
Lines 411 to 423
A renderer is currently defined as a two-key dictionary:
I can add a third key, "should_suggest" which is a function that returns True or False for a given query. If that key is missing it is assumed to return True.
One catch: what arguments should be passed to the should_suggest(...) function?
UPDATE: now calling it can_render instead.
Originally posted by @simonw in #581 (comment)
The text was updated successfully, but these errors were encountered:
This can_render callback should take the same arguments as the redesigned render (previously called callback): #581 (comment)
Sorry, something went wrong.
I'm going to rename callback to render but continue supporting callback until Datasette 1.0.
Can I come up with a better name than should_suggest?
It's a check that sees if the current query is supported by the renderer plugin. Some options:
I like can_render.
This should be optionally awaitable, as in #776
Release notes for 0.43
Refs #581, #770, #729, #706, #751, #706, #744, #771, #773
Use can_render to only suggest .atom when supported by query
Will release as 0.6. Depends on Datasette 0.43. Closes #10.
See also simonw/datasette#770
No branches or pull requests