← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/transifex into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/transifex into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/transifex/+merge/113771

- added try to catch traceback shown on incorrect pw or username

-- 
https://code.launchpad.net/~googol/openlp/transifex/+merge/113771
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/transifex into lp:openlp.
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py	2012-06-22 14:14:53 +0000
+++ scripts/translation_utils.py	2012-07-06 16:54:17 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+2 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
 
@@ -199,7 +199,11 @@
     request = urllib2.Request(url + '?details')
     request.add_header('Authorization', auth_header)
     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())
     languages = [lang[u'code'] for lang in json_dict[u'available_languages']]
     for language in languages:
@@ -214,6 +218,7 @@
         fd.write(response.read())
         fd.close()
     print_quiet(u'   Done.')
+    return True
 
 def prepare_project():
     """
@@ -310,7 +315,8 @@
         for command in command_stack:
             print_quiet(u'%d.' % (command_stack.current_index), False)
             if command == Command.Download:
-                download_translations()
+                if not download_translations():
+                    return
             elif command == Command.Prepare:
                 prepare_project()
             elif command == Command.Update: