From cc7dcfb35abd6a70301329ee45e568a479e620dc Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Thu, 1 Nov 2018 13:44:00 +0100 Subject: [PATCH] Update Updater Bugfix author in opds-feed --- cps/helper.py | 7 ++----- cps/templates/feed.xml | 11 ++++++----- cps/web.py | 9 +++++---- 3 files changed, 13 insertions(+), 14 deletions(-) mode change 100755 => 100644 cps/helper.py diff --git a/cps/helper.py b/cps/helper.py old mode 100755 new mode 100644 index 5001f5d3..3b6be191 --- a/cps/helper.py +++ b/cps/helper.py @@ -399,15 +399,12 @@ class Updater(threading.Thread): z.extractall(tmp_dir) self.status = 4 self.update_source(os.path.join(tmp_dir, os.path.splitext(fname)[0]), ub.config.get_main_dir) - self.status = 5 - db.session.close() - db.engine.dispose() - ub.session.close() - ub.engine.dispose() self.status = 6 + time.sleep(2) server.Server.setRestartTyp(True) server.Server.stopServer() self.status = 7 + time.sleep(2) except requests.exceptions.HTTPError as ex: logging.getLogger('cps.web').info( u'HTTP Error' + ' ' + str(ex)) self.status = 8 diff --git a/cps/templates/feed.xml b/cps/templates/feed.xml index 428dd363..540f57ed 100644 --- a/cps/templates/feed.xml +++ b/cps/templates/feed.xml @@ -43,11 +43,12 @@ {{entry.title}} {{entry.uuid}} {{entry.atom_timestamp}} - - {{entry.authors[0].name}} - - - {% if publishers.__len__() > 0 %} + {% if entry.authors.__len__() > 0 %} + + {{entry.authors[0].name}} + + {% endif %} + {% if entry.publishers.__len__() > 0 %} {{entry.publishers[0].name}} diff --git a/cps/web.py b/cps/web.py index 6bc179ee..979cb64a 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1289,9 +1289,9 @@ def get_updater_status(): "1": _(u'Requesting update package'), "2": _(u'Downloading update package'), "3": _(u'Unzipping update package'), - "4": _(u'Files are replaced'), + "4": _(u'Replacing files'), "5": _(u'Database connections are closed'), - "6": _(u'Server is stopped'), + "6": _(u'Stopping server'), "7": _(u'Update finished, please press okay and reload page'), "8": _(u'Update failed:') + u' ' + _(u'HTTP Error'), "9": _(u'Update failed:') + u' ' + _(u'Connection error'), @@ -1305,8 +1305,9 @@ def get_updater_status(): elif request.method == "GET": try: status['status'] = helper.updater_thread.get_update_status() - except Exception: - status['status'] = 11 + except Exception as e: + app.logger.exception(e) + status['status'] = 7 return json.dumps(status)