Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
Nabu
Commits
9c423835
Commit
9c423835
authored
Apr 17, 2020
by
Pierre Paleo
Browse files
validator: optional_float_validator to take a float
parent
49d24933
Pipeline
#24641
passed with stage
in 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nabu/resources/validators.py
View file @
9c423835
...
...
@@ -189,7 +189,9 @@ def float_validator(val):
@
validator
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
)
assert
error
is
None
,
"Invalid number"
else
:
...
...
Pierre Paleo
@paleo
mentioned in merge request
!30 (closed)
·
Apr 17, 2020
mentioned in merge request
!30 (closed)
mentioned in merge request !30
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment