From 0b5651a5ed6553c1ddb3d9c25dd3b0019fc97ad7 Mon Sep 17 00:00:00 2001 From: guerler Date: Wed, 24 Feb 2016 13:39:22 -0500 Subject: [PATCH] Do not rely on __current_case__ --- lib/galaxy/tools/parameters/grouping.py | 27 +++++++++---------------- test/api/test_workflows.py | 3 --- test/api/test_workflows_from_yaml.py | 2 -- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/lib/galaxy/tools/parameters/grouping.py b/lib/galaxy/tools/parameters/grouping.py index a8e8f108e3da..9cd8fa05268e 100644 --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -540,9 +540,9 @@ def get_current_case( self, value, ignore_errors=False ): def value_to_basic( self, value, app ): rval = dict() - current_case = rval['__current_case__'] = value['__current_case__'] rval[ self.test_param.name ] = self.test_param.value_to_basic( value[ self.test_param.name ], app ) - for input in self.cases[current_case].inputs.itervalues(): + current_case = rval['__current_case__'] = self.get_current_case( value[ self.test_param.name ] ) + for input in self.cases[ current_case ].inputs.itervalues(): if input.name in value: # parameter might be absent in unverified workflow rval[ input.name ] = input.value_to_basic( value[ input.name ], app ) return rval @@ -550,23 +550,14 @@ def value_to_basic( self, value, app ): def value_from_basic( self, value, app, ignore_errors=False ): rval = dict() try: - current_case = rval['__current_case__'] = value['__current_case__'] - # Test param - if ignore_errors and self.test_param.name not in value: - # If ignoring errors, do nothing. However this is potentially very - # problematic since if we are missing the value of test param, - # the entire conditional is wrong. - pass - else: - rval[ self.test_param.name ] = self.test_param.value_from_basic( value[ self.test_param.name ], app, ignore_errors ) + rval[ self.test_param.name ] = self.test_param.value_from_basic( value.get( self.test_param.name ), app, ignore_errors ) + current_case = rval[ '__current_case__' ] = self.get_current_case( rval[ self.test_param.name ], ignore_errors ) # Inputs associated with current case - for input in self.cases[current_case].inputs.itervalues(): - if ignore_errors and input.name not in value: - # If we do not have a value, and are ignoring errors, we simply - # do nothing. There will be no value for the parameter in the - # conditional's values dictionary. - pass - else: + for input in self.cases[ current_case ].inputs.itervalues(): + # If we do not have a value, and are ignoring errors, we simply + # do nothing. There will be no value for the parameter in the + # conditional's values dictionary. + if not ignore_errors or input.name in value: rval[ input.name ] = input.value_from_basic( value[ input.name ], app, ignore_errors ) except Exception, e: if not ignore_errors: diff --git a/test/api/test_workflows.py b/test/api/test_workflows.py index 0cf21d6909db..7d0c1923ceb4 100644 --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -46,7 +46,6 @@ seed_source: seed_source_selector: set_seed seed: asdf - __current_case__: 1 label: nested_workflow connect: inner_input: first_cat#out_file1 @@ -944,7 +943,6 @@ def test_run_with_implicit_connection( self ): seed_source: seed_source_selector: set_seed seed: asdf - __current_case__: 1 test_data: test_input: "hello world" """, history_id=history_id, wait=False) @@ -1025,7 +1023,6 @@ def test_run_with_text_connection( self ): seed_source_selector: set_seed seed: $link: text_input - __current_case__: 1 test_data: data_input: value: 1.bed diff --git a/test/api/test_workflows_from_yaml.py b/test/api/test_workflows_from_yaml.py index 2576068d8338..f6356599eefe 100644 --- a/test/api/test_workflows_from_yaml.py +++ b/test/api/test_workflows_from_yaml.py @@ -33,7 +33,6 @@ def test_simple_upload(self): seed_source: seed_source_selector: set_seed seed: asdf - __current_case__: 1 """) workflow = self._get("workflows/%s/download" % workflow_id).json() @@ -180,7 +179,6 @@ def test_subworkflow_simple( self ): seed_source: seed_source_selector: set_seed seed: asdf - __current_case__: 1 label: nested_workflow connect: inner_input: first_cat#out_file1