summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/register.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-03-31 20:53:13 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-03-31 20:53:13 (GMT)
commitca2b8d283ab133d5587f4faaff81a16a2a1a74ca (patch)
treed140a425bc1e056455ace5389202230060e6223f /Lib/distutils/command/register.py
parent023862890f9f3de1c71b1e98d59d675312e88afb (diff)
downloadcpython-ca2b8d283ab133d5587f4faaff81a16a2a1a74ca.zip
cpython-ca2b8d283ab133d5587f4faaff81a16a2a1a74ca.tar.gz
cpython-ca2b8d283ab133d5587f4faaff81a16a2a1a74ca.tar.bz2
more tests for the register command
Diffstat (limited to 'Lib/distutils/command/register.py')
-rw-r--r--Lib/distutils/command/register.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py
index 40661d8..f3463dc 100644
--- a/Lib/distutils/command/register.py
+++ b/Lib/distutils/command/register.py
@@ -90,14 +90,14 @@ class register(PyPIRCCommand):
''' Fetch the list of classifiers from the server.
'''
response = urllib2.urlopen(self.repository+'?:action=list_classifiers')
- print response.read()
+ log.info(response.read())
def verify_metadata(self):
''' Send the metadata to the package index server to be checked.
'''
# send the info to the server and report the result
(code, result) = self.post_to_server(self.build_post_data('verify'))
- print 'Server response (%s): %s'%(code, result)
+ log.info('Server response (%s): %s' % (code, result))
def send_metadata(self):
@@ -210,17 +210,18 @@ Your selection [default 1]: ''', log.INFO)
data['email'] = raw_input(' EMail: ')
code, result = self.post_to_server(data)
if code != 200:
- print 'Server response (%s): %s'%(code, result)
+ log.info('Server response (%s): %s' % (code, result))
else:
- print 'You will receive an email shortly.'
- print 'Follow the instructions in it to complete registration.'
+ log.info('You will receive an email shortly.')
+ log.info(('Follow the instructions in it to '
+ 'complete registration.'))
elif choice == '3':
data = {':action': 'password_reset'}
data['email'] = ''
while not data['email']:
data['email'] = raw_input('Your email address: ')
code, result = self.post_to_server(data)
- print 'Server response (%s): %s'%(code, result)
+ log.info('Server response (%s): %s' % (code, result))
def build_post_data(self, action):
# figure the data to send - the metadata plus some additional
@@ -253,8 +254,10 @@ Your selection [default 1]: ''', log.INFO)
def post_to_server(self, data, auth=None):
''' Post a query to the server, and return a string response.
'''
- self.announce('Registering %s to %s' % (data['name'],
- self.repository), log.INFO)
+ if 'name' in data:
+ self.announce('Registering %s to %s' % (data['name'],
+ self.repository),
+ log.INFO)
# Build up the MIME payload for the urllib2 POST data
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
sep_boundary = '\n--' + boundary
@@ -301,5 +304,7 @@ Your selection [default 1]: ''', log.INFO)
data = result.read()
result = 200, 'OK'
if self.show_response:
- print '-'*75, data, '-'*75
+ dashes = '-' * 75
+ self.announce('%s%s%s' % (dashes, data, dashes))
+
return result