commit/galaxy-central: dan: Allow select_param.fields.name method of accessing additional attributes from dynamic options work for multiple selects.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/5e67b3ddbda2/ changeset: 5e67b3ddbda2 user: dan date: 2011-12-05 17:37:46 summary: Allow select_param.fields.name method of accessing additional attributes from dynamic options work for multiple selects. affected #: 2 files diff -r 52de9815a7c4438c03daaa478df29c037e18f2a1 -r 5e67b3ddbda241bf8a24969ac6caa47e9cbe5d9b lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2190,11 +2190,14 @@ Only applicable for dynamic_options selects, which have more than simple 'options' defined (name, value, selected). """ def __init__( self, input, value, other_values ): - self.input = input - self.value = value - self.other_values = other_values + self._input = input + self._value = value + self._other_values = other_values + self._fields = {} def __getattr__( self, name ): - return self.input.options.get_field_by_name_for_value( name, self.value, None, self.other_values ) + if name not in self._fields: + self._fields[ name ] = self._input.options.get_field_by_name_for_value( name, self._value, None, self._other_values ) + return self._input.separator.join( map( str, self._fields[ name ] ) ) def __init__( self, input, value, app, other_values={} ): self.input = input diff -r 52de9815a7c4438c03daaa478df29c037e18f2a1 -r 5e67b3ddbda241bf8a24969ac6caa47e9cbe5d9b lib/galaxy/tools/parameters/dynamic_options.py --- a/lib/galaxy/tools/parameters/dynamic_options.py +++ b/lib/galaxy/tools/parameters/dynamic_options.py @@ -525,13 +525,18 @@ """ Get contents of field by name for specified value. """ + rval = [] if isinstance( field_name, int ): field_index = field_name else: assert field_name in self.columns, "Requested '%s' column missing from column def" % field_name field_index = self.columns[ field_name ] - for fields in self.get_fields_by_value( value, trans, other_values ): - return fields[ field_index ] + if not isinstance( value, list ): + value = [value] + for val in value: + for fields in self.get_fields_by_value( val, trans, other_values ): + rval.append( fields[ field_index ] ) + return rval def get_options( self, trans, other_values ): rval = [] Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket