mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Fix validation
This commit is contained in:
parent
d5dff6ccda
commit
57e81092fe
1 changed files with 8 additions and 4 deletions
|
@ -68,20 +68,24 @@ def validating_input(
|
|||
|
||||
ans = None
|
||||
first_run = True
|
||||
done_validation = False
|
||||
|
||||
while ans is None or not adj_check_constraints_function(ans):
|
||||
while not done_validation or not adj_check_constraints_function(ans):
|
||||
if not first_run:
|
||||
done_validation = False
|
||||
print("Invalid input!\n")
|
||||
else:
|
||||
first_run = False
|
||||
|
||||
ans = input(prompt)
|
||||
try:
|
||||
formatted_ans = format_function(ans)
|
||||
ans = format_function(ans)
|
||||
except Exception as ex:
|
||||
ans = None
|
||||
continue
|
||||
else:
|
||||
done_validation = True
|
||||
|
||||
return formatted_ans
|
||||
return ans
|
||||
|
||||
|
||||
def confirm(prompt):
|
||||
|
|
Loading…
Reference in a new issue