commit/galaxy-central: dan: For select tool parameter, when testing input values, raise ValueErrors instead of assert/AssertionErrors, as ValueError are cased to be caught. Fixes errors on rerun, when options have been removed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/83fb18cb8c3d/ Changeset: 83fb18cb8c3d Branch: next-stable User: dan Date: 2015-02-17 20:17:17+00:00 Summary: For select tool parameter, when testing input values, raise ValueErrors instead of assert/AssertionErrors, as ValueError are cased to be caught. Fixes errors on rerun, when options have been removed. Affected #: 1 file diff -r b6d15f14d0b392c4e9d9db56129bc67d6d4ba26b -r 83fb18cb8c3d21351f6267e574ed75c72eeb770a lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -886,14 +886,15 @@ legal_values = self.get_legal_values( trans, context ) if not legal_values and self.optional: return None - assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name + if not legal_values: + raise ValueError( "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 + if not self.repeat and not self.multiple: + raise ValueError( "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 for %s, %r, please verify" % (self.name, v)) + raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, v ) ) rval.append( v ) return rval else: @@ -903,9 +904,9 @@ if self.optional: return [] else: - raise ValueError( "No option was selected for %s but input is not optional." % self.name) + 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 for %s, %r, please verify" % (self.name, value)) + raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, value ) ) return value def to_html_value( self, value, app ): @@ -918,8 +919,8 @@ if value is None: return "None" if isinstance( value, list ): - if not( self.repeat ): - assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name + if not self.repeat and not self.multiple: + raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name ) value = map( str, value ) else: value = str( 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