Use plugin name as JSON object keys

This commit is contained in:
jtc42 2019-11-19 21:47:11 +00:00
parent 83391f7edf
commit 0cb678beed

View file

@ -19,12 +19,12 @@ def plugins_representation(plugin_loader_object: PluginLoader):
Returns: Returns:
dict: Dictionary representation of all plugins dict: Dictionary representation of all plugins
""" """
plugins = [] plugins = {}
for plugin in plugin_loader_object.active: for plugin in plugin_loader_object.active:
logging.debug(f"Representing plugin {plugin._name}") logging.debug(f"Representing plugin {plugin._name}")
d = { d = {
"name": plugin._name, "python_name": plugin._name_python_safe,
"plugin": str(plugin), "plugin": str(plugin),
"views": {}, "views": {},
"form": plugin.form, "form": plugin.form,
@ -40,7 +40,7 @@ def plugins_representation(plugin_loader_object: PluginLoader):
d["views"][view_id] = view_d d["views"][view_id] = view_d
plugins.append(d) plugins[plugin._name] = d
return plugins return plugins