Skip to content

Commit

Permalink
Do not rely on __current_case__
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Feb 25, 2016
1 parent d32c6b9 commit 0b5651a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
27 changes: 9 additions & 18 deletions lib/galaxy/tools/parameters/grouping.py
Expand Up @@ -540,33 +540,24 @@ 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

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:
Expand Down
3 changes: 0 additions & 3 deletions test/api/test_workflows.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions test/api/test_workflows_from_yaml.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b5651a

Please sign in to comment.