From 510290feea4bb328566770b636f9f093d00e93b0 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 16 Aug 2016 10:34:57 -0400 Subject: [PATCH 1/4] Add example of regressed 16.04 behavior related to dbkey output actions. --- test/functional/tools/dbkey_output_action.xml | 24 +++++++++++++++++++ test/functional/tools/samples_tool_conf.xml | 1 + 2 files changed, 25 insertions(+) create mode 100644 test/functional/tools/dbkey_output_action.xml diff --git a/test/functional/tools/dbkey_output_action.xml b/test/functional/tools/dbkey_output_action.xml new file mode 100644 index 000000000000..89d00c09aff7 --- /dev/null +++ b/test/functional/tools/dbkey_output_action.xml @@ -0,0 +1,24 @@ + + 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 @@ + From 88d02dba6e851f0f60758a575920f6e7b130e261 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 16 Aug 2016 12:55:56 -0400 Subject: [PATCH 2/4] Don't fill in a cheetah default if unavailable. ... in metadata hack from #961. --- lib/galaxy/tools/actions/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 0110d5a05a4b1b357a3f321471fce1b2d4960e67 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 16 Aug 2016 14:08:38 -0400 Subject: [PATCH 3/4] Add a test case to dbkey_output_action.xml. Per @nsoranzo's template and suggestion. --- test/functional/tools/dbkey_output_action.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/functional/tools/dbkey_output_action.xml b/test/functional/tools/dbkey_output_action.xml index 89d00c09aff7..9d100105ec5c 100644 --- a/test/functional/tools/dbkey_output_action.xml +++ b/test/functional/tools/dbkey_output_action.xml @@ -21,4 +21,16 @@ + + + + + + + + + + + + \ No newline at end of file From e06cf9a97802d4c6a2ab97d973a373675e68b751 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 16 Aug 2016 14:12:17 -0400 Subject: [PATCH 4/4] Add None check to fill_template... ... as requested by @nsoranzo. --- lib/galaxy/util/template.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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] ) )