-
-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
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? Sign in to your account
register_output_renderer can_render mechanism #770
Comments
This
|
I'm going to rename |
Can I come up with a better name than It's a check that sees if the current query is supported by the renderer plugin. Some options:
I like |
This should be optionally awaitable, as in #776 |
Will release as 0.6. Depends on Datasette 0.43. Closes #10. See also simonw/datasette#770
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:
datasette/datasette/views/base.py
Lines 411 to 423 in 2d099ad
A renderer is currently defined as a two-key dictionary:
I can add a third key,
"should_suggest"
which is a function that returnsTrue
orFalse
for a given query. If that key is missing it is assumed to returnTrue
.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: