Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply metadata setter for default to conditionals #7197

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/galaxy/tools/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,25 @@ def set_metadata_defaults(self, output, dataset, tool, on_text, trans, incoming,
<action name="column_names" type="metadata" default="${','.join([input.name for input in $individual_inputs ])}" />
</actions>
</data>

or

<actions>
<conditional name="format">
<when value="something_good">
<action type="metadata" name="column_names" default="one,two,three" />
</when>
</conditional>
</actions>
"""
if output.actions:
action_list = output.actions.actions
for action in output.actions.actions:
if action.tag == "metadata" and action.default:
if action.tag == "conditional":
for case in action.cases:
action_list.extend(case.actions)
for action in action_list:
if action.tag == "metadata" and hasattr(action, "default") and action.default:
metadata_new_value = fill_template(action.default, context=params).split(",")
dataset.metadata.__setattr__(str(action.name), metadata_new_value)

Expand Down