commit/galaxy-central: 3 new changesets
3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/242cd6a9b919/ Changeset: 242cd6a9b919 User: jmchilton Date: 2013-04-08 22:43:33 Summary: For even the most vanilla multiple selection tool parameters, if no option is selected and the tool is rerun the GUI indicates "An invalid option was selected, please verify" with a scary red box even though the tool will run fine. I feel there must be a cleaner way to address this, but it would probably be very invasive. Affected #: 1 file diff -r 788cd3d065413b2611d82375a5d0d562775ea529 -r 242cd6a9b919a5b47b2405bdabe94317e8008614 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -712,6 +712,8 @@ rval.append( v ) return rval else: + if self.multiple and value == "None" and "None" not in legal_values: + return [] if value not in legal_values: raise ValueError( "An invalid option was selected, please verify" ) return value https://bitbucket.org/galaxy/galaxy-central/commits/32b5ba798a39/ Changeset: 32b5ba798a39 User: jmchilton Date: 2013-04-15 01:59:13 Summary: Allow non-optional multiple select tool parameters. Affected #: 1 file diff -r 242cd6a9b919a5b47b2405bdabe94317e8008614 -r 32b5ba798a39d9a8169514614013fc5b2225edf3 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -623,6 +623,8 @@ def __init__( self, tool, elem, context=None ): ToolParameter.__init__( self, tool, elem ) self.multiple = string_as_bool( elem.get( 'multiple', False ) ) + # Multiple selects are optional by default, single selection is the inverse. + self.optional = string_as_bool( elem.get( 'optional', self.multiple ) ) self.display = elem.get( 'display', None ) self.separator = elem.get( 'separator', ',' ) self.legal_values = set() @@ -712,8 +714,13 @@ rval.append( v ) return rval else: - if self.multiple and value == "None" and "None" not in legal_values: - return [] + value_is_none = ( value == "None" and "None" not in legal_values ) + if value_is_none: + if self.multiple: + if self.optional: + return [] + else: + raise ValueError( "No option was selected but input is not optional." ) if value not in legal_values: raise ValueError( "An invalid option was selected, please verify" ) return value https://bitbucket.org/galaxy/galaxy-central/commits/7e800d8223d9/ Changeset: 7e800d8223d9 User: dan Date: 2013-04-15 19:13:35 Summary: Merged in jmchilton/galaxy-central-multi-input-tool-fixes-2 (pull request #154) Fix for empty multiple selections Affected #: 1 file diff -r ad1ad2e1cce31b1d4f916633970e8a39d54067eb -r 7e800d8223d95326cb956fbad0ee89e5a6e84f58 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -623,6 +623,8 @@ def __init__( self, tool, elem, context=None ): ToolParameter.__init__( self, tool, elem ) self.multiple = string_as_bool( elem.get( 'multiple', False ) ) + # Multiple selects are optional by default, single selection is the inverse. + self.optional = string_as_bool( elem.get( 'optional', self.multiple ) ) self.display = elem.get( 'display', None ) self.separator = elem.get( 'separator', ',' ) self.legal_values = set() @@ -712,6 +714,13 @@ rval.append( v ) return rval else: + value_is_none = ( value == "None" and "None" not in legal_values ) + if value_is_none: + if self.multiple: + if self.optional: + return [] + else: + raise ValueError( "No option was selected but input is not optional." ) if value not in legal_values: raise ValueError( "An invalid option was selected, please verify" ) return value 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)
-
commits-noreply@bitbucket.org