1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Fix validation

This commit is contained in:
Mo 2022-05-17 13:39:08 +02:00
parent d5dff6ccda
commit 57e81092fe

View file

@ -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):