1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/32eadec01e3e/ Changeset: 32eadec01e3e User: dan Date: 2014-02-20 17:31:07 Summary: Rework logic for setting selection of DataToolParameter. Fixes issue seen with rerun where incorrect options were selected. Affected #: 1 file diff -r 01a572fb8b4c463efa1b2091298fad3ec7ea2958 -r 32eadec01e3ebeb076b68938269e22f45fb202bb lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1621,7 +1621,7 @@ if type( value ) != list: value = [ value ] field = form_builder.SelectField( self.name, self.multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values ) - + # CRUCIAL: the dataset_collector function needs to be local to DataToolParameter.get_html_field() def dataset_collector( hdas, parent_hid ): current_user_roles = trans.get_current_user_roles() @@ -1659,20 +1659,18 @@ # Also collect children via association object dataset_collector( hda.children, hid ) dataset_collector( history.active_datasets_children_and_roles, None ) - some_data = bool( field.options ) - if some_data: - if value is None or len( field.options ) == 1: - # Ensure that the last item is always selected - a, b, c = field.options[-1] - if self.optional: - field.options[-1] = a, b, False - else: - field.options[-1] = a, b, True + + set_selected = field.get_selected( return_label=True, return_value=True, multi=False ) is not None + # Ensure than an item is always selected if self.optional: - if not value: + if set_selected: + field.add_option( "Selection is Optional", 'None', False ) + else: field.add_option( "Selection is Optional", 'None', True ) - else: - field.add_option( "Selection is Optional", 'None', False ) + elif not set_selected and bool( field.options ): + # Select the last item + a, b, c = field.options[-1] + field.options[-1] = a, b, True return field def get_initial_value( self, trans, context, history=None ): 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.