From 99b7239bc0a743c1194cf7b1a2443da276f26fa9 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 19 Sep 2017 21:36:59 -0700 Subject: [PATCH] A little cleanup --- openlp/plugins/bibles/lib/importers/http.py | 5 ----- openlp/plugins/remotes/deploy.py | 14 +++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/openlp/plugins/bibles/lib/importers/http.py b/openlp/plugins/bibles/lib/importers/http.py index c6dc90667..ffc2ddfbf 100644 --- a/openlp/plugins/bibles/lib/importers/http.py +++ b/openlp/plugins/bibles/lib/importers/http.py @@ -289,11 +289,6 @@ class BGExtract(RegistryProperties): if not page_source: send_error_message('download') return None - # TODO: Is this even necessary anymore? - # try: - # page_source = str(page_source, 'utf8') - # except UnicodeDecodeError: - # page_source = str(page_source, 'cp1251') try: soup = BeautifulSoup(page_source, 'lxml') except Exception: diff --git a/openlp/plugins/remotes/deploy.py b/openlp/plugins/remotes/deploy.py index d159c9b16..a56792f62 100644 --- a/openlp/plugins/remotes/deploy.py +++ b/openlp/plugins/remotes/deploy.py @@ -19,10 +19,11 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### - +""" +Download and "install" the remote web client +""" import os -import zipfile -import urllib.error +from zipfile import ZipFile from openlp.core.common import AppLocation, Registry from openlp.core.common.httputils import url_get_file, get_web_page, get_url_file_size @@ -38,7 +39,7 @@ def deploy_zipfile(app_root, zip_name): :return: None """ zip_file = os.path.join(app_root, zip_name) - web_zip = zipfile.ZipFile(zip_file) + web_zip = ZipFile(zip_file) web_zip.extractall(app_root) @@ -48,9 +49,8 @@ def download_sha256(): """ user_agent = 'OpenLP/' + Registry().get('application').applicationVersion() try: - web_config = get_web_page('{host}{name}'.format(host='https://get.openlp.org/webclient/', name='download.cfg'), - headers={'User-Agent': user_agent}) - except (urllib.error.URLError, ConnectionError) as err: + web_config = get_web_page('https://get.openlp.org/webclient/download.cfg', headers={'User-Agent': user_agent}) + except ConnectionError: return False file_bits = web_config.split() return file_bits[0], file_bits[2]