From 4df49010b37d79dc8f167d099b236c97ae7aefed Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 9 Oct 2023 12:07:34 -0400 Subject: [PATCH] Fix parameter display for tools with sections Fixes: ``` Message Uncaught exception in exposed API method: Stack Trace(most recent call first) TypeError: Object of type method is not JSON serializable File "galaxy/util/json.py", line 74, in safe_dumps dumped = json.dumps(obj, allow_nan=False, **kwargs) File "__init__.py", line 234, in dumps return cls( File "json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type method is not JSON serializable File "galaxy/web/framework/decorators.py", line 341, in decorator rval = format_return_as_json(rval, jsonp_callback, pretty=trans.debug) File "galaxy/web/framework/decorators.py", line 378, in format_return_as_json json = safe_dumps(rval, **dumps_kwargs) File "galaxy/util/json.py", line 77, in safe_dumps dumped = json.dumps(obj, allow_nan=False, **kwargs) File "__init__.py", line 234, in dumps return cls( File "json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' ``` from https://sentry.galaxyproject.org/share/issue/665556bc240f4a04978f7c81c2be629c/ --- lib/galaxy/managers/jobs.py | 2 -- lib/galaxy/tools/parameters/grouping.py | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/managers/jobs.py b/lib/galaxy/managers/jobs.py index e76208ce91d2..3254396fcf78 100644 --- a/lib/galaxy/managers/jobs.py +++ b/lib/galaxy/managers/jobs.py @@ -965,8 +965,6 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None) # Get parameter label. if input.type == "conditional": label = input.test_param.label - elif input.type == "repeat": - label = input.label() else: label = input.label or input.name rval.append( diff --git a/lib/galaxy/tools/parameters/grouping.py b/lib/galaxy/tools/parameters/grouping.py index 14383ae2fd06..5428ca836295 100644 --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -102,6 +102,7 @@ def title(self, value): def title_plural(self): return inflector.pluralize(self.title) + @property def label(self): return f"Repeat ({self.title})" @@ -183,6 +184,7 @@ def __init__(self): def title_plural(self): return inflector.pluralize(self.title) + @property def label(self): return f"Section ({self.title})"