More workflow and dynamic options compatibility fixes.

This commit is contained in:
Daniel Blankenberg
2008-06-05 16:35:51 +00:00
parent a4252908c8
commit dac0f0105d
4 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ class DefaultToolAction( object ):
if target_ext in data.get_converter_types():
assoc = data.get_associated_files_by_type( "CONVERTED_%s" % target_ext )
if assoc: data = assoc[0].dataset
elif input.converter_safe( param_values ):
elif input.converter_safe( param_values, trans ):
#run converter here
assoc = trans.app.model.DatasetAssociatedFile( parent_id = data.id, file_type = "CONVERTED_%s" % target_ext, metadata_safe = False )
new_data = data.datatype.convert_dataset( trans, data, target_ext, return_output = True, visible = False ).values()[0]
+7 -5
View File
@@ -471,7 +471,7 @@ class SelectToolParameter( ToolParameter ):
# Dynamic options are not yet supported in workflow, allow
# specifying the value as text for now.
if self.is_dynamic and trans.workflow_building_mode \
and ( self.options is None or self.options.data_ref is not None ):
and ( self.options is None or self.options.dataset_ref_name is not None ):
assert isinstance( value, UnvalidatedValue )
value = value.value
if self.multiple:
@@ -495,7 +495,7 @@ class SelectToolParameter( ToolParameter ):
# HACK: trans may be None here if doing late validation, this is
# treated the same as not being in workflow mode
if self.is_dynamic and ( trans and trans.workflow_building_mode ) \
and ( self.options is None or self.options.data_ref is not None ):
and ( self.options is None or self.options.dataset_ref_name is not None ):
if self.multiple:
value = value.split( "\n" )
return UnvalidatedValue( value )
@@ -536,7 +536,7 @@ class SelectToolParameter( ToolParameter ):
def get_initial_value( self, trans, context ):
# More working around dynamic options for workflow
if self.is_dynamic and trans.workflow_building_mode \
and ( self.options is None or self.options.data_ref is not None ):
and ( self.options is None or self.options.dataset_ref_name is not None ):
# Really the best we can do?
return UnvalidatedValue( None )
options = list( self.get_options( trans, context ) )
@@ -1056,7 +1056,7 @@ class DataToolParameter( ToolParameter ):
assoc = data.get_associated_files_by_type( "CONVERTED_%s" % target_ext )
if assoc:
data = assoc[0].dataset
elif not self.converter_safe( other_values ):
elif not self.converter_safe( other_values, trans ):
continue
selected = ( value and ( data in value ) )
field.add_option( "%s: (as %s) %s" % ( hid, target_ext, data.name[:30] ), data.id, selected )
@@ -1172,7 +1172,9 @@ class DataToolParameter( ToolParameter ):
else:
return []
def converter_safe( self, other_values ):
def converter_safe( self, other_values, trans ):
if trans.workflow_building_mode:
return False
if self.tool.config_files:
return False #dataset conversion and configuration files currently only work with datasets that have already been converted
converter_safe = [True]
@@ -103,7 +103,7 @@ class DataMetaFilter( Filter ):
return dataset_value in file_value.split( self.separator )
return file_value == dataset_value
ref = other_values.get( self.ref_name, None )
assert ref is not None, "Required dependency '%s' not found in incoming values" % ref
assert ref is not None or trans.workflow_building_mode, "Required dependency '%s' not found in incoming values" % ref
if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.Dataset ):
return [] #not a valid dataset
meta_value = ref.metadata.get( self.key, None )
@@ -146,6 +146,7 @@ class ParamValueFilter( Filter ):
def get_dependency_name( self ):
return self.ref_name
def filter_options( self, options, trans, other_values ):
if trans.workflow_building_mode: return []
ref = str( other_values.get( self.ref_name, None ) )
assert ref is not None, "Required dependency '%s' not found in incoming values" % ref
rval = []
+4 -4
View File
@@ -41,15 +41,15 @@ from galaxy.tools.parameters import DataToolParameter
<% current_case = group_values['__current_case__'] %>
<% prefix = prefix + input.name + "|" %>
<% group_errors = errors.get( input.name, {} ) %>
${row_for_param( input.test_param, group_values[ input.test_param.name ], group_errors, prefix, step )}
${row_for_param( input.test_param, group_values[ input.test_param.name ], group_values, group_errors, prefix, step )}
${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, prefix + input.name + "|", step )}
%else:
${row_for_param( input, values[ input.name ], errors, prefix, step )}
${row_for_param( input, values[ input.name ], values, errors, prefix, step )}
%endif
%endfor
</%def>
<%def name="row_for_param( param, value, error_dict, prefix, step )">
<%def name="row_for_param( param, value, values, error_dict, prefix, step )">
## -- ${param.name} -- ${step.state.inputs} --
%if error_dict.has_key( param.name ):
<% cls = "form-row form-row-error" %>
@@ -66,7 +66,7 @@ from galaxy.tools.parameters import DataToolParameter
%>
Output dataset '${conn.output_name}' from step ${int(conn.output_step.order_index)+1}
%else:
${param.get_html_field( t, dict(), dict() ).get_html( str(step.id) + "|" + prefix )}
${param.get_html_field( t, dict(), values ).get_html( str(step.id) + "|" + prefix )}
%endif
%else:
${param.value_to_display_text( value, app )}