diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index 5cfee0ff06b8..845d86b3322c 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -628,7 +628,7 @@ def set_metadata_defaults( self, output, dataset, tool, on_text, trans, incoming """ if output.actions: for action in output.actions.actions: - if action.tag == "metadata": + if action.tag == "metadata" and action.default: metadata_new_value = fill_template( action.default, context=params ).split(",") dataset.metadata.__setattr__(str(action.name), metadata_new_value) diff --git a/lib/galaxy/util/template.py b/lib/galaxy/util/template.py index 8e50f8e34d91..ef62853a781c 100644 --- a/lib/galaxy/util/template.py +++ b/lib/galaxy/util/template.py @@ -1,7 +1,16 @@ +"""Entry point for the usage of Cheetah templating within Galaxy.""" from Cheetah.Template import Template def fill_template( template_text, context=None, **kwargs ): + """Fill a cheetah template out for specified context. + + If template_text is None, an exception will be thrown, if context + is None (the default) - keyword arguments to this function will be used + as the context. + """ + if template_text is None: + raise TypeError("Template text specified as None to fill_template.") if not context: context = kwargs return str( Template( source=template_text, searchList=[context] ) ) diff --git a/test/functional/tools/dbkey_output_action.xml b/test/functional/tools/dbkey_output_action.xml new file mode 100644 index 000000000000..9d100105ec5c --- /dev/null +++ b/test/functional/tools/dbkey_output_action.xml @@ -0,0 +1,36 @@ + + echo foo > $mapped_reads + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 669d28ed2fa4..a5dfee0d12d9 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -18,6 +18,7 @@ +