details: http://www.bx.psu.edu/hg/galaxy/rev/52d5450e34e4 changeset: 3297:52d5450e34e4 user: James Taylor <james@jamestaylor.org> date: Thu Jan 28 11:38:38 2010 -0500 description: Workflow: fix for dealing with changes to the test param name when the conditional is unchanged. Message display is still not perfect for nested messages, but shouldn't cause error's anymore diffstat: lib/galaxy/tools/__init__.py | 12 ++++++++++-- lib/galaxy/tools/parameters/grouping.py | 10 +++++++++- tools/sr_mapping/bowtie_wrapper.xml | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diffs (54 lines): diff -r 30cd8d9f8ac9 -r 52d5450e34e4 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py Thu Jan 28 11:06:38 2010 -0500 +++ b/lib/galaxy/tools/__init__.py Thu Jan 28 11:38:38 2010 -0500 @@ -1097,8 +1097,16 @@ self.check_and_update_param_values_helper( input.inputs, d, trans, messages, context, rep_prefix ) elif isinstance( input, Conditional ): group_values = values[ input.name ] - current = group_values["__current_case__"] - self.check_and_update_param_values_helper( input.cases[current].inputs, group_values, trans, messages, context, prefix ) + if input.test_param.name not in group_values: + # No test param invalidates the whole conditional + values[ input.name ] = group_values = input.get_initial_value( trans, context ) + messages[ input.test_param.name ] = "No value found for '%s%s', used default" % ( prefix, input.test_param.label ) + current_case = group_values['__current_case__'] + for child_input in input.cases[current_case].inputs.itervalues(): + messages[ child_input.name ] = "Value no longer valid for '%s%s', replaced with default" % ( prefix, child_input.label ) + else: + current = group_values["__current_case__"] + self.check_and_update_param_values_helper( input.cases[current].inputs, group_values, trans, messages, context, prefix ) else: # Regular tool parameter, no recursion needed pass diff -r 30cd8d9f8ac9 -r 52d5450e34e4 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py Thu Jan 28 11:06:38 2010 -0500 +++ b/lib/galaxy/tools/parameters/grouping.py Thu Jan 28 11:38:38 2010 -0500 @@ -359,7 +359,15 @@ def value_from_basic( self, value, app, ignore_errors=False ): rval = dict() current_case = rval['__current_case__'] = value['__current_case__'] - rval[ self.test_param.name ] = self.test_param.value_from_basic( value[ self.test_param.name ], app, ignore_errors ) + # 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 ) + # 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 diff -r 30cd8d9f8ac9 -r 52d5450e34e4 tools/sr_mapping/bowtie_wrapper.xml --- a/tools/sr_mapping/bowtie_wrapper.xml Thu Jan 28 11:06:38 2010 -0500 +++ b/tools/sr_mapping/bowtie_wrapper.xml Thu Jan 28 11:38:38 2010 -0500 @@ -186,7 +186,7 @@ </command> <inputs> <conditional name="refGenomeSource"> - <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options"> + <param name="genomeSourceFood" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options"> <option value="indexed">Use a built-in index</option> <option value="history">Use one from the history</option> </param>