mirror of
https://github.com/python/cpython.git
synced 2025-08-18 15:51:23 +00:00
[Patch #684398] Rename verbose argument to show-response; don't conditionalize the get_classifiers() call
This commit is contained in:
parent
3749507296
commit
23c98c5f47
1 changed files with 8 additions and 9 deletions
|
@ -26,15 +26,15 @@ class register(Command):
|
||||||
'verify the package metadata for correctness'),
|
'verify the package metadata for correctness'),
|
||||||
('list-classifiers', None,
|
('list-classifiers', None,
|
||||||
'list the valid Trove classifiers'),
|
'list the valid Trove classifiers'),
|
||||||
('verbose', None,
|
('show-response', None,
|
||||||
'display full response from server'),
|
'display full response text from server'),
|
||||||
]
|
]
|
||||||
boolean_options = ['verify', 'verbose', 'list-classifiers']
|
boolean_options = ['verify', 'show-response', 'list-classifiers']
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.repository = None
|
self.repository = None
|
||||||
self.verify = 0
|
self.verify = 0
|
||||||
self.verbose = 0
|
self.show_response = 0
|
||||||
self.list_classifiers = 0
|
self.list_classifiers = 0
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
|
@ -232,9 +232,8 @@ Your selection [default 1]: ''',
|
||||||
'description': meta.get_long_description(),
|
'description': meta.get_long_description(),
|
||||||
'keywords': meta.get_keywords(),
|
'keywords': meta.get_keywords(),
|
||||||
'platform': meta.get_platforms(),
|
'platform': meta.get_platforms(),
|
||||||
|
'classifiers': meta.get_classifiers(),
|
||||||
}
|
}
|
||||||
if hasattr(meta, 'classifiers'):
|
|
||||||
data['classifiers'] = meta.get_classifiers()
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def post_to_server(self, data, auth=None):
|
def post_to_server(self, data, auth=None):
|
||||||
|
@ -277,16 +276,16 @@ Your selection [default 1]: ''',
|
||||||
try:
|
try:
|
||||||
result = opener.open(req)
|
result = opener.open(req)
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
if self.verbose:
|
if self.show_response:
|
||||||
data = e.fp.read()
|
data = e.fp.read()
|
||||||
result = e.code, e.msg
|
result = e.code, e.msg
|
||||||
except urllib2.URLError, e:
|
except urllib2.URLError, e:
|
||||||
result = 500, str(e)
|
result = 500, str(e)
|
||||||
else:
|
else:
|
||||||
if self.verbose:
|
if self.show_response:
|
||||||
data = result.read()
|
data = result.read()
|
||||||
result = 200, 'OK'
|
result = 200, 'OK'
|
||||||
if self.verbose:
|
if self.show_response:
|
||||||
print '-'*75, data, '-'*75
|
print '-'*75, data, '-'*75
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue