Allow workflows to recognize "data_meta" filters in dynamic options as

forcing runtime validation.
This commit is contained in:
James Taylor
2008-12-16 17:05:28 -05:00
parent 9ca2331917
commit 54385c8313
2 changed files with 8 additions and 3 deletions
+3 -3
View File
@@ -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 )