[hg] galaxy 1734: Have DataMetaFilter in dynamic_options.py retu...
details: http://www.bx.psu.edu/hg/galaxy/rev/dc753c56c745 changeset: 1734:dc753c56c745 user: Dan Blankenberg <dan@bx.psu.edu> date: Fri Feb 06 13:32:44 2009 -0500 description: Have DataMetaFilter in dynamic_options.py return a list of UnvalidatedValues when the referenced metadata value is not set. 2 file(s) affected in this change: lib/galaxy/tools/parameters/basic.py lib/galaxy/tools/parameters/dynamic_options.py diffs (40 lines): diff -r a4214de3752e -r dc753c56c745 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py Tue Feb 03 18:34:27 2009 -0500 +++ b/lib/galaxy/tools/parameters/basic.py Fri Feb 06 13:32:44 2009 -0500 @@ -485,8 +485,12 @@ else: return self.static_options def get_legal_values( self, trans, other_values ): + def _get_UnvalidatedValue_value( value ): + if isinstance( value, UnvalidatedValue ): + return value.value + return value if self.options: - return set( v for _, v, _ in self.options.get_options( trans, other_values ) ) + return map( _get_UnvalidatedValue_value, set( v for _, v, _ in self.options.get_options( trans, other_values ) ) ) elif self.dynamic_options: return set( v for _, v, _ in eval( self.dynamic_options, self.tool.code_namespace, other_values ) ) else: @@ -511,6 +515,9 @@ field = form_builder.SelectField( self.name, self.multiple, self.display, self.refresh_on_change ) options = self.get_options( trans, other_values ) for text, optval, selected in options: + if isinstance( optval, UnvalidatedValue ): + optval = optval.value + text = "%s (unvalidated)" % text if value: selected = ( optval in value ) field.add_option( text, optval, selected ) diff -r a4214de3752e -r dc753c56c745 lib/galaxy/tools/parameters/dynamic_options.py --- a/lib/galaxy/tools/parameters/dynamic_options.py Tue Feb 03 18:34:27 2009 -0500 +++ b/lib/galaxy/tools/parameters/dynamic_options.py Fri Feb 06 13:32:44 2009 -0500 @@ -108,7 +108,8 @@ if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.HistoryDatasetAssociation ): return [] #not a valid dataset meta_value = ref.metadata.get( self.key, None ) - assert meta_value is not None, "Required metadata value '%s' not found in referenced dataset" % self.key + if meta_value is None: #assert meta_value is not None, "Required metadata value '%s' not found in referenced dataset" % self.key + return [ ( disp_name, basic.UnvalidatedValue( optval ), selected ) for disp_name, optval, selected in options ] if self.column is not None: rval = []
participants (1)
-
Greg Von Kuster