Update user_interaction.py

This commit is contained in:
Dylan M. Taylor 2021-04-22 15:18:59 -04:00 committed by GitHub
parent 935b878c96
commit bd9d2c9125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions

View File

@ -130,6 +130,8 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
return users, super_users return users, super_users
def ask_for_a_timezone(): def ask_for_a_timezone():
exists = False
while not exists:
timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip() timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip()
if timezone == '': if timezone == '':
timezone = 'UTC' timezone = 'UTC'
@ -137,7 +139,7 @@ def ask_for_a_timezone():
return timezone return timezone
else: else:
log( log(
f"Time zone {timezone} does not exist, continuing with system default.", f"Specified timezone {timezone} does not exist.",
level=LOG_LEVELS.Warning, level=LOG_LEVELS.Warning,
fg='red' fg='red'
) )