3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9ba27992bfed/ Changeset: 9ba27992bfed Branch: peterjc/clearer-error-messages-where-parameter-v-1418233351514 User: peterjc Date: 2014-12-10 17:43:03+00:00 Summary: Clearer error messages where parameter validation fails Affected #: 1 file diff -r d66ad58a40e31defb6de0eb8b8b543b7e0f26ae5 -r 9ba27992bfed77dccbe59768d7de587f40f3c64b lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -839,11 +839,11 @@ legal_values = self.get_legal_values( trans, context ) 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 +853,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 +869,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 +1522,10 @@ 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 = [] 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 self.get_legal_values( trans, other_values ): raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, val)) rval.append( val ) return rval https://bitbucket.org/galaxy/galaxy-central/commits/f77d82d21050/ Changeset: f77d82d21050 Branch: peterjc/clearer-error-messages-where-parameter-v-1418233351514 User: peterjc Date: 2014-12-10 18:00:21+00:00 Summary: Clearer error messages if parameter as no legal values Affected #: 1 file diff -r 9ba27992bfed77dccbe59768d7de587f40f3c64b -r f77d82d2105034f021c82aee20bdffdaf862915a lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -837,6 +837,7 @@ 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 %s is not expecting multiple values" % self.name @@ -1524,8 +1525,11 @@ if not( self.repeat ) and len( value ) > 1: 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 for %s, %r, please verify" % (self.name, val)) + 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 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.