openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #11460
[Merge] lp:~googol/openlp/i18n into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/i18n into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/i18n/+merge/72381
Hello,
I would rather use urllib.urlretrieve than urllib.urlopen and open().write().
--
https://code.launchpad.net/~googol/openlp/i18n/+merge/72381
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/i18n into lp:openlp.
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py 2011-05-25 05:51:08 +0000
+++ scripts/translation_utils.py 2011-08-22 07:06:29 +0000
@@ -186,25 +186,6 @@
page = urllib.urlopen(REVIEW_URL)
page.close()
-
-def download_file(source_filename, dest_filename):
- """
- Download a file and save it to disk.
-
- ``source_filename``
- The file to download.
-
- ``dest_filename``
- The new local file name.
- """
- print_verbose(u'Downloading from: %s' % (SERVER_URL + source_filename))
- page = urllib.urlopen(SERVER_URL + source_filename)
- content = page.read().decode('utf8')
- page.close()
- file = open(dest_filename, u'w')
- file.write(content.encode('utf8'))
- file.close()
-
def download_translations():
"""
This method downloads the translation files from the Pootle server.
@@ -219,7 +200,7 @@
filename = os.path.join(os.path.abspath(u'..'), u'resources', u'i18n',
language_file)
print_verbose(u'Get Translation File: %s' % filename)
- download_file(language_file, filename)
+ urllib.urlretrieve(SERVER_URL + language_file, filename)
print_quiet(u' Done.')
def prepare_project():
@@ -304,7 +285,7 @@
if not language.endswith(u'.ts'):
language += u'.ts'
filename = os.path.join(os.path.abspath(u'..'), u'resources', u'i18n', language)
- download_file(u'en.ts', filename)
+ urllib.urlretrieve(SERVER_URL + u'en.ts', filename)
print_quiet(u' ** Please Note **')
print_quiet(u' In order to get this file into OpenLP and onto the '
u'Pootle translation server you will need to subscribe to the '
Follow ups