mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3702 from guerler/fix_boolean_handling
Properly handle boolean values when parsed to a string-based/default tool parameter
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
Basic tool parameters.
|
||||
"""
|
||||
import logging
|
||||
import numbers
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
@@ -131,8 +130,6 @@ class ToolParameter( object, Dictifiable ):
|
||||
|
||||
def to_python( self, value, app ):
|
||||
"""Convert a value created with to_json back to an object representation"""
|
||||
if isinstance( value, numbers.Number ):
|
||||
return unicodify( value )
|
||||
return value
|
||||
|
||||
def value_to_basic( self, value, app, use_security=False ):
|
||||
|
||||
@@ -56,10 +56,13 @@ def swap_inf_nan( val ):
|
||||
def safe_loads( arg ):
|
||||
"""
|
||||
This is a wrapper around loads that returns the parsed value instead of
|
||||
raising a value error.
|
||||
raising a value error. It also avoids autoconversion of non-iterables
|
||||
i.e numeric and boolean values.
|
||||
"""
|
||||
try:
|
||||
loaded = json.loads( arg )
|
||||
if loaded is not None and not isinstance( loaded, collections.Iterable ):
|
||||
loaded = arg
|
||||
except ( TypeError, ValueError ):
|
||||
loaded = arg
|
||||
return loaded
|
||||
|
||||
Reference in New Issue
Block a user