[Python-checkins] distutils2: Let’s not use input in 2.x

eric.araujo python-checkins at python.org
Tue Sep 13 13:43:49 CEST 2011


http://hg.python.org/distutils2/rev/467abb891c1a
changeset: 1142:467abb891c1a
user: Éric Araujo <merwok at netwok.org>
date: Mon Sep 12 01:40:43 2011 +0200
summary:
 Let’s not use input in 2.x
files:
 distutils2/command/register.py | 12 ++++++------
 distutils2/util.py | 2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/distutils2/command/register.py b/distutils2/command/register.py
--- a/distutils2/command/register.py
+++ b/distutils2/command/register.py
@@ -144,7 +144,7 @@
 4. quit
 Your selection [default 1]: ''')
 
- choice = input()
+ choice = raw_input()
 if not choice:
 choice = '1'
 elif choice not in choices:
@@ -153,7 +153,7 @@
 if choice == '1':
 # get the username and password
 while not username:
- username = input('Username: ')
+ username = raw_input('Username: ')
 while not password:
 password = getpass.getpass('Password: ')
 
@@ -179,7 +179,7 @@
 get_pypirc_path())
 choice = 'X'
 while choice.lower() not in 'yn':
- choice = input('Save your login (y/N)?')
+ choice = raw_input('Save your login (y/N)?')
 if not choice:
 choice = 'n'
 if choice.lower() == 'y':
@@ -190,7 +190,7 @@
 data['name'] = data['password'] = data['email'] = ''
 data['confirm'] = None
 while not data['name']:
- data['name'] = input('Username: ')
+ data['name'] = raw_input('Username: ')
 while data['password'] != data['confirm']:
 while not data['password']:
 data['password'] = getpass.getpass('Password: ')
@@ -201,7 +201,7 @@
 data['confirm'] = None
 print "Password and confirm don't match!"
 while not data['email']:
- data['email'] = input(' EMail: ')
+ data['email'] = raw_input(' EMail: ')
 code, result = self.post_to_server(data)
 if code != 200:
 logger.info('server response (%s): %s', code, result)
@@ -212,7 +212,7 @@
 data = {':action': 'password_reset'}
 data['email'] = ''
 while not data['email']:
- data['email'] = input('Your email address: ')
+ data['email'] = raw_input('Your email address: ')
 code, result = self.post_to_server(data)
 logger.info('server response (%s): %s', code, result)
 
diff --git a/distutils2/util.py b/distutils2/util.py
--- a/distutils2/util.py
+++ b/distutils2/util.py
@@ -1156,7 +1156,7 @@
 def ask(message, options):
 """Prompt the user with *message*; *options* contains allowed responses."""
 while True:
- response = input(message)
+ response = raw_input(message)
 response = response.strip().lower()
 if response not in options:
 print 'invalid response:', repr(response)
-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /