forked from openlp/openlp
added try to catch traceback shown on incorrect pw or username
This commit is contained in:
parent
bd390521ea
commit
456bd374be
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
2 #!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
@ -199,7 +199,11 @@ def download_translations():
|
|||||||
request = urllib2.Request(url + '?details')
|
request = urllib2.Request(url + '?details')
|
||||||
request.add_header('Authorization', auth_header)
|
request.add_header('Authorization', auth_header)
|
||||||
print_verbose(u'Downloading list of languages from: %s' % url)
|
print_verbose(u'Downloading list of languages from: %s' % url)
|
||||||
json_response = urllib2.urlopen(request)
|
try:
|
||||||
|
json_response = urllib2.urlopen(request)
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
print_quiet(u'Username or password incorrect.')
|
||||||
|
return False
|
||||||
json_dict = json.loads(json_response.read())
|
json_dict = json.loads(json_response.read())
|
||||||
languages = [lang[u'code'] for lang in json_dict[u'available_languages']]
|
languages = [lang[u'code'] for lang in json_dict[u'available_languages']]
|
||||||
for language in languages:
|
for language in languages:
|
||||||
@ -214,6 +218,7 @@ def download_translations():
|
|||||||
fd.write(response.read())
|
fd.write(response.read())
|
||||||
fd.close()
|
fd.close()
|
||||||
print_quiet(u' Done.')
|
print_quiet(u' Done.')
|
||||||
|
return True
|
||||||
|
|
||||||
def prepare_project():
|
def prepare_project():
|
||||||
"""
|
"""
|
||||||
@ -310,7 +315,8 @@ def process_stack(command_stack):
|
|||||||
for command in command_stack:
|
for command in command_stack:
|
||||||
print_quiet(u'%d.' % (command_stack.current_index), False)
|
print_quiet(u'%d.' % (command_stack.current_index), False)
|
||||||
if command == Command.Download:
|
if command == Command.Download:
|
||||||
download_translations()
|
if not download_translations():
|
||||||
|
return
|
||||||
elif command == Command.Prepare:
|
elif command == Command.Prepare:
|
||||||
prepare_project()
|
prepare_project()
|
||||||
elif command == Command.Update:
|
elif command == Command.Update:
|
||||||
|
Loading…
Reference in New Issue
Block a user