kopia lustrzana https://github.com/simonw/datasette
Return plugins and hooks in predictable order
rodzic
43c30ce023
commit
e1770766ce
|
@ -764,13 +764,14 @@ class Datasette:
|
|||
should_show_all = all
|
||||
if not should_show_all:
|
||||
ps = [p for p in ps if p["name"] not in DEFAULT_PLUGINS]
|
||||
ps.sort(key=lambda p: p["name"])
|
||||
return [
|
||||
{
|
||||
"name": p["name"],
|
||||
"static": p["static_path"] is not None,
|
||||
"templates": p["templates_path"] is not None,
|
||||
"version": p.get("version"),
|
||||
"hooks": list(set(p["hooks"])),
|
||||
"hooks": list(sorted(set(p["hooks"]))),
|
||||
}
|
||||
for p in ps
|
||||
]
|
||||
|
|
|
@ -109,24 +109,6 @@ You can also use the ``datasette plugins`` command::
|
|||
If you run ``datasette plugins --all`` it will include default plugins that ship as part of Datasette::
|
||||
|
||||
[
|
||||
{
|
||||
"name": "datasette.publish.heroku",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"publish_subcommand"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.sql_functions",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"prepare_connection"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.actor_auth_cookie",
|
||||
"static": false,
|
||||
|
@ -145,15 +127,6 @@ If you run ``datasette plugins --all`` it will include default plugins that ship
|
|||
"register_output_renderer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.facets",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"register_facet_classes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.default_magic_parameters",
|
||||
"static": false,
|
||||
|
@ -163,6 +136,15 @@ If you run ``datasette plugins --all`` it will include default plugins that ship
|
|||
"register_magic_parameters"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.default_menu_links",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"menu_links"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.default_permissions",
|
||||
"static": false,
|
||||
|
@ -173,12 +155,12 @@ If you run ``datasette plugins --all`` it will include default plugins that ship
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.default_menu_links",
|
||||
"name": "datasette.facets",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"menu_links"
|
||||
"register_facet_classes"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -198,6 +180,24 @@ If you run ``datasette plugins --all`` it will include default plugins that ship
|
|||
"hooks": [
|
||||
"publish_subcommand"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.publish.heroku",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"publish_subcommand"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.sql_functions",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"prepare_connection"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -106,9 +106,7 @@ def test_spatialite_error_if_cannot_find_load_extension_spatialite():
|
|||
def test_plugins_cli(app_client):
|
||||
runner = CliRunner()
|
||||
result1 = runner.invoke(cli, ["plugins"])
|
||||
assert sorted(EXPECTED_PLUGINS, key=lambda p: p["name"]) == sorted(
|
||||
json.loads(result1.output), key=lambda p: p["name"]
|
||||
)
|
||||
assert json.loads(result1.output) == EXPECTED_PLUGINS
|
||||
# Try with --all
|
||||
result2 = runner.invoke(cli, ["plugins", "--all"])
|
||||
names = [p["name"] for p in json.loads(result2.output)]
|
||||
|
|
Ładowanie…
Reference in New Issue