Fix for params_to_incoming.

This commit is contained in:
Daniel Blankenberg
2012-11-07 21:06:54 -05:00
parent cacdb2e961
commit c824f061af
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -115,5 +115,5 @@ def params_to_incoming( incoming, inputs, input_values, app, name_prefix="" ):
incoming[ new_name_prefix + input.test_param.name ] = values[ input.test_param.name ]
params_to_incoming( incoming, input.cases[current].inputs, values, app, new_name_prefix )
else:
incoming[ name_prefix + input.name ] = input.to_string( input_values.get( input.name ), app )
incoming[ name_prefix + input.name ] = input.to_html_value( input_values.get( input.name ), app )
+9
View File
@@ -106,6 +106,10 @@ class ToolParameter( object ):
"""
return value
def to_html_value( self, value, app ):
"""Convert an object value to the value expected from an html post"""
return self.to_string( value, app )
def to_string( self, value, app ):
"""Convert a value to a string representation suitable for persisting"""
return str( value )
@@ -370,6 +374,11 @@ class BooleanToolParameter( ToolParameter ):
return form_builder.CheckboxField( self.name, checked, refresh_on_change = self.refresh_on_change )
def from_html( self, value, trans=None, other_values={} ):
return form_builder.CheckboxField.is_checked( value )
def to_html_value( self, value, app ):
if value:
return [ 'true', 'true' ]
else:
return [ 'true' ]
def to_python( self, value, app ):
return ( value == 'True' )
def get_initial_value( self, trans, context ):