From 2e6e7afc4dd0f0d20512dbdc91bc21d8796ef6ab Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:09:48 +0200 Subject: [PATCH 1/3] Serialize `tool_shed_urls` directly from the API --- lib/galaxy/managers/configuration.py | 4 ++++ lib/galaxy/webapps/base/controller.py | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index d9bcf001e3e2..e9520e540cff 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -233,5 +233,9 @@ def _defaults_to(default): "user_library_import_dir": _defaults_to(None), "allow_library_path_paste": _defaults_to(False), "allow_user_deletion": _defaults_to(False), + "tool_shed_urls": self._serialize_tool_shed_urls, } ) + + def _serialize_tool_shed_urls(self, item: Any, key: str, **context): + return list(self.app.tool_shed_registry.tool_sheds.values()) if self.app.tool_shed_registry else [] diff --git a/lib/galaxy/webapps/base/controller.py b/lib/galaxy/webapps/base/controller.py index ad579fc01595..9335aa84fe2d 100644 --- a/lib/galaxy/webapps/base/controller.py +++ b/lib/galaxy/webapps/base/controller.py @@ -300,9 +300,6 @@ def _get_extended_config(self, trans): "enable_webhooks": True if trans.app.webhooks_registry.webhooks else False, "message_box_visible": trans.app.config.message_box_visible, "show_inactivity_warning": trans.app.config.user_activation_on and trans.user and not trans.user.active, - "tool_shed_urls": list(trans.app.tool_shed_registry.tool_sheds.values()) - if trans.app.tool_shed_registry - else [], "tool_dynamic_configs": list(trans.app.toolbox.dynamic_conf_filenames()), } From 82daf49148716d7a039f479d4db11efab431af6b Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:14:40 +0200 Subject: [PATCH 2/3] Update configuration API test --- lib/galaxy_test/api/test_configuration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy_test/api/test_configuration.py b/lib/galaxy_test/api/test_configuration.py index ccfa162dd089..06d5d1b45b17 100644 --- a/lib/galaxy_test/api/test_configuration.py +++ b/lib/galaxy_test/api/test_configuration.py @@ -20,6 +20,7 @@ "user_library_import_dir", "allow_library_path_paste", "allow_user_deletion", + "tool_shed_urls", ] From f14fd253bcd87b05cf2624cae53f0d4fd6ce6d99 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 17 Aug 2023 09:43:47 +0200 Subject: [PATCH 3/3] Add return type annotation --- lib/galaxy/managers/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index e9520e540cff..2f5f4b8700f5 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -237,5 +237,5 @@ def _defaults_to(default): } ) - def _serialize_tool_shed_urls(self, item: Any, key: str, **context): + def _serialize_tool_shed_urls(self, item: Any, key: str, **context) -> List[str]: return list(self.app.tool_shed_registry.tool_sheds.values()) if self.app.tool_shed_registry else []