Simon Willison
090dff542b
Action menu descriptions
...
* Refactor tests to extract get_actions_links() helper
* Table, database and query action menu items now support optional descriptions
Closes #2294
2024-03-06 22:54:06 -05:00
Simon Willison
4d24bf6b34
Don't explain an explain even in the demo, refs #2293
2024-03-05 18:14:55 -08:00
Simon Willison
5de6797d4a
Better demo plugin for query_actions, refs #2293
2024-03-05 18:06:38 -08:00
Simon Willison
6ec0081f5d
`query_actions` plugin hook
...
* New query_actions plugin hook, closes #2283
2024-02-27 21:55:16 -08:00
Simon Willison
52a1dac5d2
Test proving $env works for datasette.yml, closes #2255
2024-02-06 21:00:55 -08:00
Simon Willison
69c6e95323
Fixed a bunch of unused imports spotted with ruff
2024-02-06 17:27:20 -08:00
Simon Willison
be4f02335f
Treat plugins in metadata as if they were in config, closes #2248
2024-02-01 15:33:33 -08:00
Simon Willison
d4bc2b2dfc
Remove fail_if_plugins_in_metadata, part of #2248
2024-02-01 14:44:16 -08:00
Simon Willison
bcc4f6bf1f
track_event() mechanism for analytics and plugins
...
* Closes #2240
* Documentation for event plugin hooks, refs #2240
* Include example track_event plugin in docs, refs #2240
* Tests for track_event() and register_events() hooks, refs #2240
* Initial documentation for core events, refs #2240
* Internals documentation for datasette.track_event()
2024-01-31 15:21:40 -08:00
Simon Willison
5c64af6936
Upgrade to latest Black, closes #2239
2024-01-30 19:55:26 -08:00
Simon Willison
c3caf36af7
Template slot family of plugin hooks - top_homepage() and others
...
New plugin hooks:
top_homepage
top_database
top_table
top_row
top_query
top_canned_query
New datasette.utils.make_slot_function()
Closes #1191
2024-01-30 19:54:03 -08:00
Simon Willison
c7a4706bcc
jinja2_environment_from_request() plugin hook
...
Closes #2225
2024-01-05 14:33:23 -08:00
Alex Garcia
3d6d1e3050
Raise an exception if a "plugins" block exists in metadata.json
2023-10-12 09:20:50 -07:00
Alex Garcia
35deaabcb1
Move non-metadata configuration from metadata.yaml to datasette.yaml
...
* Allow and permission blocks moved to datasette.yaml
* Documentation updates, initial framework for configuration reference
2023-10-12 09:16:37 -07:00
Simon Willison
852f501485
Switch from pkg_resources to importlib.metadata in app.py, refs #2057
2023-09-16 09:35:18 -07:00
Alex Garcia
b2ec8717c3
Plugin configuration now lives in datasette.yaml/json
...
* Checkpoint, moving top-level plugin config to datasette.json
* Support database-level and table-level plugin configuration in datasette.yaml
Refs #2093
2023-09-13 14:06:25 -07:00
Simon Willison
b645174271
actors_from_ids plugin hook and datasette.actors_from_ids() method ( #2181 )
...
* Prototype of actors_from_ids plugin hook, refs #2180
* datasette-remote-actors example plugin, refs #2180
2023-09-07 21:23:59 -07:00
Alex Garcia
92b8bf38c0
Add new `--internal internal.db` option, deprecate legacy `_internal` database
...
Refs:
- #2157
---------
Co-authored-by: Simon Willison <swillison@gmail.com>
2023-08-28 20:24:23 -07:00
Simon Willison
1377a290cd
New JSON design for query views ( #2118 )
...
* Refs #2111 , closes #2110
* New Context dataclass/subclass mechanism, refs #2127
* Define QueryContext and extract get_tables() method, refs #2127
* Fix OPTIONS bug by porting DaatbaseView to be a View subclass
* Expose async_view_for_class.view_class for test_routes test
* Error/truncated aruments for renderers, closes #2130
2023-08-07 18:47:39 -07:00
Simon Willison
c39d600aef
Fix all E741 Ambiguous variable name warnings, refs #2090
2023-06-29 08:05:24 -07:00
Simon Willison
d97e82df3c
?_extra= support and TableView refactor to table_view
...
* Implemented ?_extra= option for JSON views, refs #262
* New dependency: asyncinject
* Remove now-obsolete TableView class
2023-03-22 15:49:39 -07:00
Simon Willison
0b4a286914
render_cell(..., request) argument, closes #2007
2023-01-27 19:34:14 -08:00
Simon Willison
234230e595
Default JSON shape is now objects - refs #1914 , #1709
2022-12-31 10:52:37 -08:00
Simon Willison
89cffcf14c
Reset _metadata_local in a couple of tests
...
Refs https://github.com/simonw/datasette/pull/1960#issuecomment-1356476886
2022-12-17 13:47:55 -08:00
Simon Willison
9c43b4164d
Removed @pytest.mark.ds_client mark - refs #1959
...
I don't need it - can run 'pytest -k ds_client' instead.
See https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828
2022-12-17 13:47:55 -08:00
Simon Willison
30f1a0705b
ds_client for test_plugins.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
45979eb723
Rename permission created by demo plugin
...
It was showing up as 'new-permission' on https://latest.datasette.io/-/permissions
which I thought was confusing
2022-12-12 21:21:01 -08:00
Simon Willison
8bf06a76b5
register_permissions() plugin hook ( #1940 )
...
* Docs for permissions: in metadata, refs #1636
* Refactor default_permissions.py to help with implementation of #1636
* register_permissions() plugin hook, closes #1939 - also refs #1938
* Tests for register_permissions() hook, refs #1939
* Documentation for datasette.permissions, refs #1939
* permission_allowed() falls back on Permission.default, refs #1939
* Raise StartupError on duplicate permissions
* Allow dupe permisisons if exact matches
2022-12-12 18:05:54 -08:00
Simon Willison
c7956eed77
datasette create-token command, refs #1859
2022-10-25 21:26:12 -07:00
Simon Willison
78dad236df
check_visibility can now take multiple permissions into account
...
Closes #1829
2022-10-23 19:11:33 -07:00
Simon Willison
1a5e5f2aa9
Refactor breadcrumbs to respect permissions, refs #1831
2022-10-13 14:42:52 -07:00
Simon Willison
ddc999ad12
Async support for prepare_jinja2_environment, closes #1809
2022-09-16 20:38:24 -07:00
Simon Willison
b40872f5e5
prepare_jinja2_environment(datasette) argument, refs #1809
2022-09-14 14:31:54 -07:00
Simon Willison
c09c53f345
New handle_exception plugin hook, refs #1770
...
Also refs:
- https://github.com/simonw/datasette-sentry/issues/1
- https://github.com/simonw/datasette-show-errors/issues/2
2022-07-17 16:24:39 -07:00
Simon Willison
6373bb3414
Expose current SQLite row to render_cell hook, closes #1300
2022-07-07 09:30:49 -07:00
Simon Willison
4e47a2d894
Fixed bug where tables with a column called n caused 500 errors
...
Closes #1228
2022-03-18 18:37:54 -07:00
Simon Willison
aa7f0037a4
filters_from_request plugin hook, now used in TableView
...
- New `filters_from_request` plugin hook, closes #473
- Used it to extract the logic from TableView that handles `_search` and
`_through` and `_where` - refs #1518
Also needed for this plugin work: https://github.com/simonw/datasette-leaflet-freedraw/issues/7
2021-12-17 11:02:14 -08:00
Simon Willison
69244a617b
Rename city_id to _city_id in fixtures, refs #1525
2021-11-29 22:20:42 -08:00
Simon Willison
c617e1769e
Fixed test I broke with new repr() in ##1519
2021-11-19 15:13:17 -08:00
Simon Willison
6e971b4ac1
Test confirming plugins can over-ride default routes, closes #1517
2021-11-18 19:07:21 -08:00
Simon Willison
c306b696de
Correct facet links for columns with a leading underscore, closes #1506
2021-11-13 20:44:54 -08:00
Simon Willison
b267b57754
Upgrade to httpx 0.20
...
* Upgrade to httpx 0.20, closes #1488
* TestClient.post() should not default to following redirects
2021-10-14 11:03:44 -07:00
Simon Willison
30c18576d6
register_commands() plugin hook, closes #1449
2021-08-27 18:39:42 -07:00
Simon Willison
818b0b76a2
Test table render_cell async as well as query results, refs #1425
2021-08-08 16:07:52 -07:00
Simon Willison
3bb6409a6c
render_cell() can now return an awaitable, refs
2021-08-08 16:05:00 -07:00
Simon Willison
eccfeb0871
register_routes() plugin hook datasette argument, closes #1404
2021-07-26 16:16:46 -07:00
Simon Willison
05a312caf3
Applied Black, refs #1368
2021-06-26 15:25:28 -07:00
Brandon Roberts
baf986c871
New get_metadata() plugin hook for dynamic metadata
...
The following hook is added:
get_metadata(
datasette=self, key=key, database=database, table=table,
fallback=fallback
)
This gets called when we're building our metdata for the rest
of the system to use. We merge whatever the plugins return
with any local metadata (from metadata.yml/yaml/json) allowing
for a live-editable dynamic Datasette.
As a security precation, local meta is *not* overwritable by
plugin hooks. The workflow for transitioning to live-meta would
be to load the plugin with the full metadata.yaml and save.
Then remove the parts of the metadata that you want to be able
to change from the file.
* Avoid race condition: don't mutate databases list
This avoids the nasty "RuntimeError: OrderedDict mutated during
iteration" error that randomly happens when a plugin adds a
new database to Datasette, using `add_database`. This change
makes the add and remove database functions more expensive, but
it prevents the random explosion race conditions that make for
confusing user experience when importing live databases.
Thanks, @brandonrobertz
2021-06-26 15:24:54 -07:00
Simon Willison
b1fd24ac9f
skip_csrf(datasette, scope) plugin hook, refs #1377
2021-06-23 15:40:09 -07:00
Simon Willison
d23a267138
Make request available to menu plugin hooks, closes #1371
2021-06-09 21:45:24 -07:00