diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 34b325a0d123..51244d5dd927 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -242,6 +242,9 @@ def to_json(self, value, app, use_security) -> str: def to_python(self, value, app): """Convert a value created with to_json back to an object representation""" + if value is None and (default_value := getattr(self, "value", None)) not in ("", None): + # None should be equivalent to no value provided, so use default + return default_value return value def value_to_basic(self, value, app, use_security=False): @@ -494,6 +497,9 @@ def to_python(self, value, app): except (TypeError, ValueError) as err: if contains_workflow_parameter(value): return value + if value is None and self.value not in ("", None): + # None should be equivalent to no value provided, so use default + return int(self.value) if not value and self.optional: return None raise err @@ -567,6 +573,9 @@ def to_python(self, value, app): except (TypeError, ValueError) as err: if contains_workflow_parameter(value): return value + if value is None and self.value not in ("", None): + # None should be equivalent to no value provided, so use default + return float(self.value) if not value and self.optional: return None raise err @@ -623,6 +632,9 @@ def from_json(self, value, trans, other_values=None): return self.to_python(value) def to_python(self, value, app=None): + if value is None and self.checked is not None: + # None should be equivalent to no value provided, so use default + return self.checked if not self.optional: ret_val = string_as_bool(value) else: