[Python-checkins] distutils2: Avoid matching '' or 'yn' when asking for 'y' or 'n' in interactive code
eric.araujo
python-checkins at python.org
Mon Nov 14 15:24:07 CET 2011
http://hg.python.org/distutils2/rev/f40475ea7a1a
changeset: 1231:f40475ea7a1a
parent: 1229:c8720f11e768
user: Éric Araujo <merwok at netwok.org>
date: Fri Nov 11 23:15:09 2011 +0100
summary:
Avoid matching '' or 'yn' when asking for 'y' or 'n' in interactive code
files:
distutils2/command/register.py | 2 +-
distutils2/create.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/distutils2/command/register.py b/distutils2/command/register.py
--- a/distutils2/command/register.py
+++ b/distutils2/command/register.py
@@ -177,7 +177,7 @@
'will be faster.\n(the login will be stored in %s)',
get_pypirc_path())
choice = 'X'
- while choice.lower() not in 'yn':
+ while choice.lower() not in ('y', 'n'):
choice = raw_input('Save your login (y/N)?')
if not choice:
choice = 'n'
diff --git a/distutils2/create.py b/distutils2/create.py
--- a/distutils2/create.py
+++ b/distutils2/create.py
@@ -136,7 +136,7 @@
question += ' (y/n)'
while 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()
print '\nERROR: You must select "Y" or "N".\n'
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list