Commit 016d8235 authored by Éric Araujo's avatar Éric Araujo

Avoid matching '' or 'yn' when asking for 'y' or 'n' in interactive code

parent 13f5bb73
...@@ -178,7 +178,7 @@ Your selection [default 1]: ''') ...@@ -178,7 +178,7 @@ Your selection [default 1]: ''')
'will be faster.\n(the login will be stored in %s)', 'will be faster.\n(the login will be stored in %s)',
get_pypirc_path()) get_pypirc_path())
choice = 'X' choice = 'X'
while choice.lower() not in 'yn': while choice.lower() not in ('y', 'n'):
choice = input('Save your login (y/N)?') choice = input('Save your login (y/N)?')
if not choice: if not choice:
choice = 'n' choice = 'n'
......
...@@ -121,7 +121,7 @@ def ask_yn(question, default=None, helptext=None): ...@@ -121,7 +121,7 @@ def ask_yn(question, default=None, helptext=None):
question += ' (y/n)' question += ' (y/n)'
while True: while True:
answer = ask(question, default, helptext, required=True) answer = ask(question, default, helptext, required=True)
if answer and answer[0].lower() in 'yn': if answer and answer[0].lower() in ('y', 'n'):
return answer[0].lower() return answer[0].lower()
print('\nERROR: You must select "Y" or "N".\n') print('\nERROR: You must select "Y" or "N".\n')
......
Markdown is supported
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