# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Dan Blankenberg <dan@bx.psu.edu> # Date 1287167414 14400 # Node ID 1f4d6b25a84e785c3feee1733a19ac10877a985b # Parent 74fa7c7c0db8ed06aeda6948d286432b61e7feb0 Fix for Integer/FloatToolParameter.get_html_field() when 'value' is provided as an integer/float. Fixes an issue seen when saving workflows: If an integer or float tool parameter is changed to a value of 0 or 0.0 and saved, the form field would be redisplayed using the default tool value; and not the value that is now saved in the database. --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -197,6 +197,10 @@ class IntegerToolParameter( TextToolPara raise ValueError( "An integer is required" ) elif self.value is None: raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be an integer" ) + def get_html_field( self, trans=None, value=None, other_values={} ): + if isinstance( value, int ): + value = str( value ) + return super( IntegerToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values ) def from_html( self, value, trans=None, other_values={} ): try: return int( value ) @@ -235,6 +239,10 @@ class FloatToolParameter( TextToolParame raise ValueError( "A real number is required" ) elif self.value is None: raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be a real number" ) + def get_html_field( self, trans=None, value=None, other_values={} ): + if isinstance( value, float ): + value = str( value ) + return super( FloatToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values ) def from_html( self, value, trans=None, other_values={} ): try: return float( value )