From 29e9cc327672ac6a6c472b2501a010a36b7782b0 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 8 Apr 2024 11:26:06 +0200 Subject: [PATCH] For workflow run form for worflows with null rename PJA Fixes: ``` AttributeError: 'NoneType' object has no attribute 'values' File "galaxy/web/framework/decorators.py", line 346, in decorator rval = func(self, trans, *args, **kwargs) File "galaxy/webapps/galaxy/api/workflows.py", line 357, in workflow_dict ret_dict = self.workflow_contents_manager.workflow_to_dict( File "galaxy/managers/workflows.py", line 907, in workflow_to_dict wf_dict = self._workflow_to_dict_run(trans, stored, workflow=workflow, history=history or trans.history) File "galaxy/managers/workflows.py", line 1025, in _workflow_to_dict_run step_model["replacement_parameters"] = step.module.get_informal_replacement_parameters(step) File "galaxy/workflow/modules.py", line 2388, in get_informal_replacement_parameters for argument in pja.action_arguments.values(): ``` from https://sentry.galaxyproject.org/share/issue/954ebe7b658f401a8a8e40987d43a91d/ --- lib/galaxy/workflow/modules.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 6af779177993..ba0692c77d52 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -2381,13 +2381,14 @@ def __to_pja(self, key, value, step): action_arguments = None return PostJobAction(value["action_type"], step, output_name, action_arguments) - def get_informal_replacement_parameters(self, step) -> List[str]: + def get_informal_replacement_parameters(self, step: WorkflowStep) -> List[str]: """Return a list of replacement parameters.""" replacement_parameters = set() for pja in step.post_job_actions: - for argument in pja.action_arguments.values(): - for match in re.findall(r"\$\{(.+?)\}", unicodify(argument)): - replacement_parameters.add(match) + if action_arguments := pja.action_arguments: + for argument in action_arguments.values(): + for match in re.findall(r"\$\{(.+?)\}", unicodify(argument)): + replacement_parameters.add(match) return list(replacement_parameters)