Commit graph

58 commits

Author SHA1 Message Date
Simon Willison
c9f1ec616e Removed resource_type from permissions system, closes #817
Refs #811, #699
2020-06-08 11:51:03 -07:00
Simon Willison
0c064c5fe2 More things you can do with plugins 2020-06-04 20:10:40 -07:00
Simon Willison
2074efa5a4 Another actor_from_request example 2020-06-04 18:38:32 -07:00
Simon Willison
8524866fdf Link to authentication docs 2020-06-04 16:58:19 -07:00
Simon Willison
461c82838d Implemented actor_from_request with tests, refs #699
Also added datasette argument to permission_allowed hook
2020-05-31 18:16:42 -07:00
Simon Willison
060a56735c actor_from_request and permission_allowed hookspecs, refs #699 2020-05-31 18:16:42 -07:00
Simon Willison
31fb006a9b Added datasette.get_database() method
Refs #576
2020-05-30 07:29:59 -07:00
Simon Willison
5ab411c733 can_render mechanism for register_output_renderer, closes #770 2020-05-27 22:57:05 -07:00
Simon Willison
57f48b8416 Made register_output_renderer callback optionally awaitable, closes #776 2020-05-27 19:43:30 -07:00
Simon Willison
52c4387c7d Redesigned register_output_renderer plugin hook, closes #581 2020-05-27 19:21:41 -07:00
Simon Willison
4b96857f17 Link to request object documentation, refs #706 2020-05-27 15:35:25 -07:00
Simon Willison
af5702220c Added datasette-media plugin to the docs 2020-05-27 13:34:12 -07:00
Simon Willison
9e6075d21f rST fixes for register_output_renderer docs 2020-05-27 11:35:31 -07:00
Simon Willison
25014ca25e
Configuration directory mode, closes #731 2020-04-27 09:30:24 -07:00
Simon Willison
227bb3e91f
Added more example plugins 2020-04-22 06:47:20 -07:00
Simon Willison
e0e7a0facf Removed Zeit Now v1 support, closes #710 2020-04-04 16:04:33 -07:00
Simon Willison
3b3cb3e8df Added example plugins to plugin hooks docs, closes #709 2020-03-24 15:29:34 -07:00
Simon Willison
fd2a74dc09
Updated publish_subcommand example 2020-03-18 17:47:53 -07:00
Simon Willison
4933035b75
RST fix 2020-03-02 08:10:16 -08:00
Simon Willison
613f6fad72
Improved extra_template_vars documentation 2020-03-02 07:12:34 -08:00
Simon Willison
a093c5f79f
.execute_write() and .execute_write_fn() methods on Database (#683)
Closes #682.
2020-02-24 20:45:07 -08:00
Simon Willison
6303ea5048 prepare_connection() now takes datasette and database args, refs #678 2020-02-21 17:32:40 -08:00
Simon Willison
3ffb8f3b98 .add_database() and .remove_database() methods, refs #671
Also made a start on the Datasette class documentation, refs #576
2020-02-13 17:27:57 -08:00
Simon Willison
a562f29655 Examples of things you can do with plugins 2019-11-27 11:19:11 -08:00
Simon Willison
aca41618f8 index view is also important for plugin hooks 2019-11-25 09:04:39 -08:00
Simon Willison
8c642f04e0
Render templates using Jinja async mode
Closes #628
2019-11-14 15:14:22 -08:00
Simon Willison
ed57e4f990 Plugin static assets support both hyphens and underscores in names
Closes #611
2019-11-01 15:15:10 -07:00
Simon Willison
973f8f139d
--plugin-secret option for datasette publish
Closes #543

Also added new --show-files option to publish now and publish cloudrun - handy for debugging.
2019-07-07 19:06:31 -07:00
Simon Willison
9998f92cc0 Updated custom facet docs, closes #482 2019-07-07 16:19:02 -07:00
Simon Willison
fcfcae21e6
extra_template_vars plugin hook (#542)
* extra_template_vars plugin hook

Closes #541

* Workaround for cwd bug

Based on https://github.com/pytest-dev/pytest/issues/1235#issuecomment-175295691
2019-07-05 17:05:56 -07:00
Simon Willison
a2d4593193
Secret plugin configuration options (#539)
Closes #538
2019-07-03 22:36:44 -07:00
Simon Willison
4d2fdafe39 Added asgi_wrapper plugin hook, closes #520 2019-07-02 21:06:25 -07:00
Simon Willison
bd4dbc8519 Rename InterruptedError => QueryInterrupted, closes #490 2019-05-27 17:16:36 -07:00
Simon Willison
870f6dd55f Replaced a straggling 'datasette publish now' reference 2019-05-19 11:12:53 -07:00
Simon Willison
a88b599cce Improved introduction copy on Plugins docs page 2019-05-15 22:18:02 -07:00
Russ Garrett
bf229c9bd8 Pass view_name to extra_body_script hook (#443)
At the moment it's not easy to tell whether the hook is being called
in (for example) the row or table view, as in both cases the
`database` and `table` parameters are provided.

This passes the `view_name` added in #441 to the `extra_body_script`
hook.
2019-05-03 09:12:19 -04:00
Simon Willison
ea66c45df9
Extract facet code out into a new plugin hook, closes #427 (#445)
Datasette previously only supported one type of faceting: exact column value counting.

With this change, faceting logic is extracted out into one or more separate classes which can implement other patterns of faceting - this is discussed in #427, but potential upcoming facet types include facet-by-date, facet-by-JSON-array, facet-by-many-2-many and more.

A new plugin hook, register_facet_classes, can be used by plugins to add in additional facet classes.

Each class must implement two methods: suggest(), which scans columns in the table to decide if they might be worth suggesting for faceting, and facet_results(), which executes the facet operation and returns results ready to be displayed in the UI.
2019-05-02 17:11:26 -07:00
Russ Garrett
cf406c0754 New plugin hook: register_output_renderer hook (#441)
Thanks @russss!

* Add register_output_renderer hook

This changeset refactors out the JSON renderer and then adds a hook and
dispatcher system to allow custom output renderers to be registered.

The CSV output renderer is untouched because supporting streaming
renderers through this system would be significantly more complex, and
probably not worthwhile.

We can't simply allow hooks to be called at request time because we need
a list of supported file extensions when the request is being routed in
order to resolve ambiguous database/table names. So, renderers need to
be registered at startup.

I've tried to make this API independent of Sanic's request/response
objects so that this can remain stable during the switch to ASGI. I'm
using dictionaries to keep it simple and to make adding additional
options in the future easy.

Fixes #440
2019-05-01 16:01:56 -07:00
Simon Willison
436b8bc1d1 Datasette 0.27 2019-01-31 19:47:05 -08:00
Simon Willison
909cc8fbdf New 'datasette plugins' command to list installed plugins 2019-01-26 12:01:16 -08:00
Simon Willison
5b02611512
Corrected import path in plugin docs 2019-01-08 16:25:29 -08:00
Simon Willison
57a71377c9
Releasing Datasette 0.25 2018-09-19 19:48:12 +02:00
Simon Willison
1f54e09230
Better docs for publish_subcommand() plugin hook 2018-08-28 11:59:50 +01:00
Simon Willison
b7c6a9f9bd
extra_css_urls(template, database, table, datasette)
The extra_css_urls and extra_js_urls hooks now take additional optional
parameters.

Also refactored them out of the Datasette class and into RenderMixin.

Plus improved plugin documentation to explicitly list parameters.
2018-08-28 11:56:57 +01:00
Simon Willison
2e836f72d9
render_cell(value, column, table, database, datasette)
The render_cell plugin hook previously was only passed value.

It is now passed (value, column, table, database, datasette).
2018-08-28 03:03:01 -07:00
Simon Willison
5cf0c6c91c
New plugin hook: extra_body_script 2018-08-28 02:02:49 -07:00
Simon Willison
0a14a4846b
Added plugin_config() method 2018-08-28 01:35:21 -07:00
Simon Willison
4ac9132240
render_cell(value) plugin hook, closes #352
New plugin hook for customizing the way cells values are rendered in HTML.

The first full example of this hook in use is https://github.com/simonw/datasette-json-html
2018-08-04 17:14:56 -07:00
Simon Willison
dbbe707841
publish_subcommand hook + default plugins mechanism, used for publish heroku/now (#349)
This change introduces a new plugin hook, publish_subcommand, which can be
used to implement new subcommands for the "datasette publish" command family.

I've used this new hook to refactor out the "publish now" and "publish heroku"
implementations into separate modules. I've also added unit tests for these
two publishers, mocking the subprocess.call and subprocess.check_output
functions.

As part of this, I introduced a mechanism for loading default plugins. These
are defined in the new "default_plugins" list inside datasette/app.py

Closes #217 (Plugin support for datasette publish)
Closes #348 (Unit tests for "datasette publish")
Refs #14, #59, #102, #103, #146, #236, #347
2018-07-25 22:15:59 -07:00
Simon Willison
72a7ae6859
Datasette 0.20: static assets and templates for plugins 2018-04-20 07:32:02 -07:00