mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow workflows to recognize "data_meta" filters in dynamic options as
forcing runtime validation.
This commit is contained in:
@@ -492,7 +492,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.dataset_ref_name is not None ):
|
||||
and ( self.options is None or self.options.has_dataset_dependencies ):
|
||||
assert isinstance( value, UnvalidatedValue )
|
||||
value = value.value
|
||||
if self.multiple:
|
||||
@@ -516,7 +516,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.dataset_ref_name is not None ):
|
||||
and ( self.options is None or self.options.has_dataset_dependencies ):
|
||||
if self.multiple:
|
||||
value = value.split( "\n" )
|
||||
return UnvalidatedValue( value )
|
||||
@@ -557,7 +557,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.dataset_ref_name is not None ):
|
||||
and ( self.options is None or self.options.has_dataset_dependencies ):
|
||||
# Really the best we can do?
|
||||
return UnvalidatedValue( None )
|
||||
options = list( self.get_options( trans, context ) )
|
||||
|
||||
@@ -78,6 +78,7 @@ class DataMetaFilter( Filter ):
|
||||
Filter.__init__( self, d_option, elem )
|
||||
self.ref_name = elem.get( "ref", None )
|
||||
assert self.ref_name is not None, "Required 'ref' attribute missing from filter"
|
||||
d_option.has_dataset_dependencies = True
|
||||
self.key = elem.get( "key", None )
|
||||
assert self.key is not None, "Required 'key' attribute missing from filter"
|
||||
self.column = elem.get( "column", None )
|
||||
@@ -290,6 +291,9 @@ class DynamicOptions( object ):
|
||||
self.file_fields = None
|
||||
self.largest_index = 0
|
||||
self.dataset_ref_name = None
|
||||
# True if the options generation depends on one or more other parameters
|
||||
# that are dataset inputs
|
||||
self.has_dataset_dependencies = False
|
||||
self.validators = []
|
||||
self.converter_safe = True
|
||||
|
||||
@@ -320,6 +324,7 @@ class DynamicOptions( object ):
|
||||
self.file_fields = self.parse_file_fields( open( data_file ) )
|
||||
elif dataset_file is not None:
|
||||
self.dataset_ref_name = dataset_file
|
||||
self.has_dataset_dependencies = True
|
||||
self.converter_safe = False
|
||||
elif from_parameter is not None:
|
||||
transform_lines = elem.get( 'transform_lines', None )
|
||||
|
||||
Reference in New Issue
Block a user