Commit 9c423835 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

validator: optional_float_validator to take a float

parent 49d24933
Pipeline #24641 passed with stage
in 48 seconds
...@@ -189,7 +189,9 @@ def float_validator(val): ...@@ -189,7 +189,9 @@ def float_validator(val):
@validator @validator
def optional_float_validator(val): def optional_float_validator(val):
if len(val.strip()) >= 1: if isinstance(val, float):
return val
elif len(val.strip()) >= 1:
val_float, error = convert_to_float(val) val_float, error = convert_to_float(val)
assert error is None, "Invalid number" assert error is None, "Invalid number"
else: else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment