datasette/datasette
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
..
publish Upgrade Heroku runtime to python-3.8.10 2021-05-27 09:11:03 -07:00
static Fix visual glitch in nav menu, closes #1367 2021-06-07 11:24:14 -07:00
templates Don't truncate list of columns on /db page, closes #1364 2021-06-06 15:07:45 -07:00
utils New get_metadata() plugin hook for dynamic metadata 2021-06-26 15:24:54 -07:00
views Default 405 for POST, plus tests 2021-06-23 15:40:09 -07:00
__init__.py Apply black to everything, enforce via unit tests (#449) 2019-05-03 22:15:14 -04:00
__main__.py Add support for running datasette as a module (#556) 2019-07-11 09:07:44 -07:00
actor_auth_cookie.py ds_author cookie can now expire, closes #829 2020-06-10 12:39:54 -07:00
app.py New get_metadata() plugin hook for dynamic metadata 2021-06-26 15:24:54 -07:00
blob_renderer.py Use f-strings in place of .format() 2020-11-15 15:24:22 -08:00
cli.py More inclusive language 2021-06-02 21:45:03 -07:00
database.py Fix for no such table: pragma_database_list, refs #1276 2021-03-28 16:44:29 -07:00
default_magic_parameters.py _header_x now defaults to empty string 2020-06-30 15:00:17 -07:00
default_menu_links.py Redirect /-/config to /-/settings, closes #1103 2020-11-24 12:19:14 -08:00
default_permissions.py Rename _schemas to _internal, closes #1156 2020-12-21 11:48:06 -08:00
facets.py More inclusive language 2021-06-02 21:45:03 -07:00
filters.py Fix for arraycontains bug, closes #1239 2021-02-22 16:22:47 -08:00
hookspecs.py New get_metadata() plugin hook for dynamic metadata 2021-06-26 15:24:54 -07:00
inspect.py Modernize code to Python 3.6+ (#1158) 2020-12-23 09:04:32 -08:00
plugins.py Navigation menu plus menu_links() hook 2020-10-29 20:45:15 -07:00
renderer.py Re-display user's query with an error message if an error occurs (#1346) 2021-06-01 20:46:20 -07:00
sql_functions.py _search= queries now correctly escaped, fixes #651 2019-12-29 18:48:30 +00:00
tracer.py Correctly escape output of ?_trace, refs #1360 2021-06-05 15:03:38 -07:00
url_builder.py Fixed bug loading database called 'test-database (1).sqlite' 2021-01-24 21:13:05 -08:00
version.py Release 0.58a1 2021-06-24 09:24:59 -07:00