Remove fail_if_plugins_in_metadata, part of #2248

This commit is contained in:
Simon Willison 2024-02-01 14:44:16 -08:00
commit d4bc2b2dfc
4 changed files with 3 additions and 31 deletions

View file

@ -1272,21 +1272,6 @@ def pairs_to_nested_config(pairs: typing.List[typing.Tuple[str, typing.Any]]) ->
return result
def fail_if_plugins_in_metadata(metadata: dict, filename=None):
"""If plugin config is inside metadata, raise an Exception"""
if metadata is not None and metadata.get("plugins") is not None:
suggested_extension = (
".yaml"
if filename is not None
and (filename.endswith(".yaml") or filename.endswith(".yml"))
else ".json"
)
raise Exception(
f'Datasette no longer accepts plugin configuration in --metadata. Move your "plugins" configuration blocks to a separate file - we suggest calling that datasette.{suggested_extension} - and start Datasette with datasette -c datasette.{suggested_extension}. See https://docs.datasette.io/en/latest/configuration.html for more details.'
)
return metadata
def make_slot_function(name, datasette, request, **kwargs):
from datasette.plugins import pm