details: http://www.bx.psu.edu/hg/galaxy/rev/6ddbf5c83efc changeset: 1592:6ddbf5c83efc user: Dan Blankenberg <dan@bx.psu.edu> date: Fri Oct 31 11:00:50 2008 -0400 description: Fixes for dealing with UnvalidatedValues (i.e. when running workflows) and also when passing None trans to dynamic options. 4 file(s) affected in this change: lib/galaxy/jobs/__init__.py lib/galaxy/tools/__init__.py lib/galaxy/tools/parameters/dynamic_options.py tools/data_source/microbial_import_code.py diffs (77 lines): diff -r c4644668afff -r 6ddbf5c83efc lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py Fri Oct 31 10:22:46 2008 -0400 +++ b/lib/galaxy/jobs/__init__.py Fri Oct 31 11:00:50 2008 -0400 @@ -464,7 +464,7 @@ # custom post process setup inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] ) out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] ) - param_dict = dict( [ ( p.name, p.value ) for p in job.parameters ] ) # why not re-use self.param_dict here? + param_dict = dict( [ ( p.name, p.value ) for p in job.parameters ] ) # why not re-use self.param_dict here? ##dunno...probably should, this causes tools.parameters.basic.UnvalidatedValue to be used in following methods instead of validated and transformed values during i.e. running workflows param_dict = self.tool.params_from_strings( param_dict, self.app ) # Check for and move associated_files self.tool.collect_associated_files(out_data) diff -r c4644668afff -r 6ddbf5c83efc lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py Fri Oct 31 10:22:46 2008 -0400 +++ b/lib/galaxy/tools/__init__.py Fri Oct 31 11:00:50 2008 -0400 @@ -948,7 +948,10 @@ # Regular tool parameter value = input_values[ input.name ] if isinstance( value, UnvalidatedValue ): - value = input.from_html( value.value, None, context ) + if value.value is None: #if value.value is None, it could not have been submited via html form and therefore .from_html can't be guaranteed to work + value = None + else: + value = input.from_html( value.value, None, context ) # Then do any further validation on the value input.validate( value, None ) input_values[ input.name ] = value diff -r c4644668afff -r 6ddbf5c83efc lib/galaxy/tools/parameters/dynamic_options.py --- a/lib/galaxy/tools/parameters/dynamic_options.py Fri Oct 31 10:22:46 2008 -0400 +++ b/lib/galaxy/tools/parameters/dynamic_options.py Fri Oct 31 11:00:50 2008 -0400 @@ -102,7 +102,7 @@ if self.multiple: return dataset_value in file_value.split( self.separator ) return file_value == dataset_value - assert self.ref_name in other_values or trans.workflow_building_mode, "Required dependency '%s' not found in incoming values" % self.ref_name + assert self.ref_name in other_values or ( trans is not None and trans.workflow_building_mode), "Required dependency '%s' not found in incoming values" % self.ref_name ref = other_values.get( self.ref_name, None ) if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.HistoryDatasetAssociation ): return [] #not a valid dataset @@ -146,9 +146,9 @@ def get_dependency_name( self ): return self.ref_name def filter_options( self, options, trans, other_values ): - if trans.workflow_building_mode: return [] + if trans is not None and trans.workflow_building_mode: return [] + assert self.ref_name in other_values, "Required dependency '%s' not found in incoming values" % self.ref_name ref = str( other_values.get( self.ref_name, None ) ) - assert ref is not None, "Required dependency '%s' not found in incoming values" % self.ref_name rval = [] for fields in options: if ( self.keep and fields[self.column] == ref ) or ( not self.keep and fields[self.column] != ref ): diff -r c4644668afff -r 6ddbf5c83efc tools/data_source/microbial_import_code.py --- a/tools/data_source/microbial_import_code.py Fri Oct 31 10:22:46 2008 -0400 +++ b/tools/data_source/microbial_import_code.py Fri Oct 31 11:00:50 2008 -0400 @@ -80,7 +80,7 @@ return microbe_info #post processing, set build for data and add additional data to history -from galaxy import datatypes, config, jobs +from galaxy import datatypes, config, jobs, tools from shutil import copyfile def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr): @@ -95,7 +95,12 @@ #if not (kingdom or group or org): if not (kingdom or org): print "Parameters are not available." - + #workflow passes galaxy.tools.parameters.basic.UnvalidatedValue instead of values + if isinstance( kingdom, tools.parameters.basic.UnvalidatedValue ): + kingdom = kingdom.value + if isinstance( org, tools.parameters.basic.UnvalidatedValue ): + org = org.value + GALAXY_DATA_INDEX_DIR = app.config.tool_data_path microbe_info = load_microbial_data( GALAXY_DATA_INDEX_DIR, sep='\t' ) new_stdout = ""