commit/galaxy-central: dannon: Merged in peterjc/galaxy-central-2/peterjc/clearer-error-messages-where-parameter-v-1418233351514 (pull request #604)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/fc60d0eeb22b/ Changeset: fc60d0eeb22b User: dannon Date: 2014-12-10 21:53:09+00:00 Summary: Merged in peterjc/galaxy-central-2/peterjc/clearer-error-messages-where-parameter-v-1418233351514 (pull request #604) Clearer error messages where parameter validation fails Affected #: 1 file diff -r 0852880c97bdcc5730d0fc396c094fbadd296931 -r fc60d0eeb22b28a2e61db5c6ec672a3dc5663845 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -837,13 +837,14 @@ value = value.split() return UnvalidatedValue( value ) legal_values = self.get_legal_values( trans, context ) + assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name if isinstance( value, list ): if not(self.repeat): - assert self.multiple, "Multiple values provided but parameter is not expecting multiple values" + assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name rval = [] for v in value: if v not in legal_values: - raise ValueError( "An invalid option was selected, please verify" ) + raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, v)) rval.append( v ) return rval else: @@ -853,9 +854,9 @@ if self.optional: return [] else: - raise ValueError( "No option was selected but input is not optional." ) + raise ValueError( "No option was selected for %s but input is not optional." % self.name) if value not in legal_values: - raise ValueError( "An invalid option was selected, please verify" ) + raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, value)) return value def to_html_value( self, value, app ): @@ -869,7 +870,7 @@ return "None" if isinstance( value, list ): if not( self.repeat ): - assert self.multiple, "Multiple values provided but parameter is not expecting multiple values" + assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name value = map( str, value ) else: value = str( value ) @@ -1522,10 +1523,13 @@ if not isinstance( value, list ): value = [value] if not( self.repeat ) and len( value ) > 1: - assert self.multiple, "Multiple values provided but parameter is not expecting multiple values" + assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name rval = [] + legal_values = self.get_legal_values( trans, other_values ) + assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name for val in value: - if val not in self.get_legal_values( trans, other_values ): raise ValueError( "An invalid option was selected, please verify" ) + if val not in legal_values: + raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, val)) rval.append( val ) return 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)
-
commits-noreply@bitbucket.org