Bugfix session commit
Bugfix get_locale Bugfix reconnect database schedule Bugfix no permission error message logging Bugfix updater
This commit is contained in:
parent
5d5a94c9e5
commit
e8e4d87d39
|
@ -185,7 +185,6 @@ def update_thumbnails():
|
||||||
@login_required
|
@login_required
|
||||||
@admin_required
|
@admin_required
|
||||||
def admin():
|
def admin():
|
||||||
locale = get_locale()
|
|
||||||
version = updater_thread.get_current_version_info()
|
version = updater_thread.get_current_version_info()
|
||||||
if version is False:
|
if version is False:
|
||||||
commit = _(u'Unknown')
|
commit = _(u'Unknown')
|
||||||
|
@ -1460,7 +1459,7 @@ def download_debug():
|
||||||
def get_update_status():
|
def get_update_status():
|
||||||
if feature_support['updater']:
|
if feature_support['updater']:
|
||||||
log.info(u"Update status requested")
|
log.info(u"Update status requested")
|
||||||
return updater_thread.get_available_updates(request.method, locale=get_locale())
|
return updater_thread.get_available_updates(request.method)
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
|
@ -441,10 +441,13 @@ class CalibreDB:
|
||||||
# instances alive once they reach the end of their respective scopes
|
# instances alive once they reach the end of their respective scopes
|
||||||
instances = WeakSet()
|
instances = WeakSet()
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, expire_on_commit=True, init=False):
|
||||||
""" Initialize a new CalibreDB session
|
""" Initialize a new CalibreDB session
|
||||||
"""
|
"""
|
||||||
self.session = None
|
self.session = None
|
||||||
|
if init:
|
||||||
|
self.init_db(expire_on_commit)
|
||||||
|
|
||||||
|
|
||||||
def init_db(self, expire_on_commit=True):
|
def init_db(self, expire_on_commit=True):
|
||||||
if self._init:
|
if self._init:
|
||||||
|
|
12
cps/fs.py
12
cps/fs.py
|
@ -39,7 +39,7 @@ class FileSystem:
|
||||||
makedirs(self._cache_dir)
|
makedirs(self._cache_dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to create path {self._cache_dir} (Permission denied).')
|
self.log.info(f'Failed to create path {self._cache_dir} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
||||||
path = join(self._cache_dir, cache_type)
|
path = join(self._cache_dir, cache_type)
|
||||||
if cache_type and not isdir(path):
|
if cache_type and not isdir(path):
|
||||||
|
@ -47,7 +47,7 @@ class FileSystem:
|
||||||
makedirs(path)
|
makedirs(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to create path {path} (Permission denied).')
|
self.log.info(f'Failed to create path {path} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
||||||
return path if cache_type else self._cache_dir
|
return path if cache_type else self._cache_dir
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class FileSystem:
|
||||||
makedirs(path)
|
makedirs(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to create path {path} (Permission denied).')
|
self.log.info(f'Failed to create path {path} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class FileSystem:
|
||||||
rmtree(self._cache_dir)
|
rmtree(self._cache_dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to delete path {self._cache_dir} (Permission denied).')
|
self.log.info(f'Failed to delete path {self._cache_dir} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
||||||
path = join(self._cache_dir, cache_type)
|
path = join(self._cache_dir, cache_type)
|
||||||
if cache_type and isdir(path):
|
if cache_type and isdir(path):
|
||||||
|
@ -83,7 +83,7 @@ class FileSystem:
|
||||||
rmtree(path)
|
rmtree(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to delete path {path} (Permission denied).')
|
self.log.info(f'Failed to delete path {path} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
||||||
def delete_cache_file(self, filename, cache_type=None):
|
def delete_cache_file(self, filename, cache_type=None):
|
||||||
path = self.get_cache_file_path(filename, cache_type)
|
path = self.get_cache_file_path(filename, cache_type)
|
||||||
|
@ -92,4 +92,4 @@ class FileSystem:
|
||||||
remove(path)
|
remove(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.log.info(f'Failed to delete path {path} (Permission denied).')
|
self.log.info(f'Failed to delete path {path} (Permission denied).')
|
||||||
return False
|
raise
|
||||||
|
|
|
@ -1015,7 +1015,6 @@ def replace_cover_thumbnail_cache(book_id):
|
||||||
|
|
||||||
|
|
||||||
def delete_thumbnail_cache():
|
def delete_thumbnail_cache():
|
||||||
if config.schedule_generate_book_covers:
|
|
||||||
WorkerThread.add(None, TaskClearCoverThumbnailCache(-1))
|
WorkerThread.add(None, TaskClearCoverThumbnailCache(-1))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ def register_scheduled_tasks(reconnect=True):
|
||||||
duration = config.schedule_duration
|
duration = config.schedule_duration
|
||||||
|
|
||||||
# Register scheduled tasks
|
# Register scheduled tasks
|
||||||
scheduler.schedule_tasks(tasks=get_scheduled_tasks(), trigger='cron', hour=start)
|
scheduler.schedule_tasks(tasks=get_scheduled_tasks(reconnect), trigger='cron', hour=start)
|
||||||
end_time = calclulate_end_time(start, duration)
|
end_time = calclulate_end_time(start, duration)
|
||||||
scheduler.schedule(func=end_scheduled_tasks, trigger='cron', name="end scheduled task", hour=end_time.hour,
|
scheduler.schedule(func=end_scheduled_tasks, trigger='cron', name="end scheduled task", hour=end_time.hour,
|
||||||
minute=end_time.minute)
|
minute=end_time.minute)
|
||||||
|
|
|
@ -55,8 +55,7 @@ class TaskConvert(CalibreTask):
|
||||||
def run(self, worker_thread):
|
def run(self, worker_thread):
|
||||||
self.worker_thread = worker_thread
|
self.worker_thread = worker_thread
|
||||||
if config.config_use_google_drive:
|
if config.config_use_google_drive:
|
||||||
worker_db = db.CalibreDB()
|
worker_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
worker_db.init_db(expire_on_commit=False)
|
|
||||||
cur_book = worker_db.get_book(self.book_id)
|
cur_book = worker_db.get_book(self.book_id)
|
||||||
self.title = cur_book.title
|
self.title = cur_book.title
|
||||||
data = worker_db.get_book_format(self.book_id, self.settings['old_book_format'])
|
data = worker_db.get_book_format(self.book_id, self.settings['old_book_format'])
|
||||||
|
@ -105,8 +104,7 @@ class TaskConvert(CalibreTask):
|
||||||
|
|
||||||
def _convert_ebook_format(self):
|
def _convert_ebook_format(self):
|
||||||
error_message = None
|
error_message = None
|
||||||
local_db = db.CalibreDB()
|
local_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
local_db.init_db(expire_on_commit=False)
|
|
||||||
file_path = self.file_path
|
file_path = self.file_path
|
||||||
book_id = self.book_id
|
book_id = self.book_id
|
||||||
format_old_ext = u'.' + self.settings['old_book_format'].lower()
|
format_old_ext = u'.' + self.settings['old_book_format'].lower()
|
||||||
|
|
|
@ -68,8 +68,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
self.log = logger.create()
|
self.log = logger.create()
|
||||||
self.book_id = book_id
|
self.book_id = book_id
|
||||||
self.app_db_session = ub.get_new_session_instance()
|
self.app_db_session = ub.get_new_session_instance()
|
||||||
self.calibre_db = db.CalibreDB()
|
# self.calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
self.calibre_db.init_db(expire_on_commit=False)
|
|
||||||
self.cache = fs.FileSystem()
|
self.cache = fs.FileSystem()
|
||||||
self.resolutions = [
|
self.resolutions = [
|
||||||
constants.COVER_THUMBNAIL_SMALL,
|
constants.COVER_THUMBNAIL_SMALL,
|
||||||
|
@ -77,7 +76,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
]
|
]
|
||||||
|
|
||||||
def run(self, worker_thread):
|
def run(self, worker_thread):
|
||||||
if self.calibre_db.session and use_IM and self.stat != STAT_CANCELLED and self.stat != STAT_ENDED:
|
if use_IM and self.stat != STAT_CANCELLED and self.stat != STAT_ENDED:
|
||||||
self.message = 'Scanning Books'
|
self.message = 'Scanning Books'
|
||||||
books_with_covers = self.get_books_with_covers(self.book_id)
|
books_with_covers = self.get_books_with_covers(self.book_id)
|
||||||
count = len(books_with_covers)
|
count = len(books_with_covers)
|
||||||
|
@ -112,11 +111,10 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
|
|
||||||
def get_books_with_covers(self, book_id=-1):
|
def get_books_with_covers(self, book_id=-1):
|
||||||
filter_exp = (db.Books.id == book_id) if book_id != -1 else True
|
filter_exp = (db.Books.id == book_id) if book_id != -1 else True
|
||||||
return self.calibre_db.session \
|
calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
.query(db.Books) \
|
books_cover = calibre_db.session.query(db.Books).filter(db.Books.has_cover == 1).filter(filter_exp).all()
|
||||||
.filter(db.Books.has_cover == 1) \
|
calibre_db.session.close()
|
||||||
.filter(filter_exp) \
|
return books_cover
|
||||||
.all()
|
|
||||||
|
|
||||||
def get_book_cover_thumbnails(self, book_id):
|
def get_book_cover_thumbnails(self, book_id):
|
||||||
return self.app_db_session \
|
return self.app_db_session \
|
||||||
|
@ -160,7 +158,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
self.app_db_session.commit()
|
self.app_db_session.commit()
|
||||||
self.generate_book_thumbnail(book, thumbnail)
|
self.generate_book_thumbnail(book, thumbnail)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error creating book thumbnail: ' + str(ex))
|
self.log.debug('Error creating book thumbnail: ' + str(ex))
|
||||||
self._handleError('Error creating book thumbnail: ' + str(ex))
|
self._handleError('Error creating book thumbnail: ' + str(ex))
|
||||||
self.app_db_session.rollback()
|
self.app_db_session.rollback()
|
||||||
|
|
||||||
|
@ -172,7 +170,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
self.cache.delete_cache_file(thumbnail.filename, constants.CACHE_TYPE_THUMBNAILS)
|
self.cache.delete_cache_file(thumbnail.filename, constants.CACHE_TYPE_THUMBNAILS)
|
||||||
self.generate_book_thumbnail(book, thumbnail)
|
self.generate_book_thumbnail(book, thumbnail)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error updating book thumbnail: ' + str(ex))
|
self.log.debug('Error updating book thumbnail: ' + str(ex))
|
||||||
self._handleError('Error updating book thumbnail: ' + str(ex))
|
self._handleError('Error updating book thumbnail: ' + str(ex))
|
||||||
self.app_db_session.rollback()
|
self.app_db_session.rollback()
|
||||||
|
|
||||||
|
@ -200,7 +198,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||||
img.save(filename=filename)
|
img.save(filename=filename)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
# Bubble exception to calling function
|
# Bubble exception to calling function
|
||||||
self.log.info('Error generating thumbnail file: ' + str(ex))
|
self.log.debug('Error generating thumbnail file: ' + str(ex))
|
||||||
raise ex
|
raise ex
|
||||||
finally:
|
finally:
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
|
@ -239,8 +237,7 @@ class TaskGenerateSeriesThumbnails(CalibreTask):
|
||||||
super(TaskGenerateSeriesThumbnails, self).__init__(task_message)
|
super(TaskGenerateSeriesThumbnails, self).__init__(task_message)
|
||||||
self.log = logger.create()
|
self.log = logger.create()
|
||||||
self.app_db_session = ub.get_new_session_instance()
|
self.app_db_session = ub.get_new_session_instance()
|
||||||
self.calibre_db = db.CalibreDB()
|
self.calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
self.calibre_db.init_db(expire_on_commit=False)
|
|
||||||
self.cache = fs.FileSystem()
|
self.cache = fs.FileSystem()
|
||||||
self.resolutions = [
|
self.resolutions = [
|
||||||
constants.COVER_THUMBNAIL_SMALL,
|
constants.COVER_THUMBNAIL_SMALL,
|
||||||
|
@ -337,7 +334,7 @@ class TaskGenerateSeriesThumbnails(CalibreTask):
|
||||||
self.app_db_session.commit()
|
self.app_db_session.commit()
|
||||||
self.generate_series_thumbnail(series_books, thumbnail)
|
self.generate_series_thumbnail(series_books, thumbnail)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error creating book thumbnail: ' + str(ex))
|
self.log.debug('Error creating book thumbnail: ' + str(ex))
|
||||||
self._handleError('Error creating book thumbnail: ' + str(ex))
|
self._handleError('Error creating book thumbnail: ' + str(ex))
|
||||||
self.app_db_session.rollback()
|
self.app_db_session.rollback()
|
||||||
|
|
||||||
|
@ -349,7 +346,7 @@ class TaskGenerateSeriesThumbnails(CalibreTask):
|
||||||
self.cache.delete_cache_file(thumbnail.filename, constants.CACHE_TYPE_THUMBNAILS)
|
self.cache.delete_cache_file(thumbnail.filename, constants.CACHE_TYPE_THUMBNAILS)
|
||||||
self.generate_series_thumbnail(series_books, thumbnail)
|
self.generate_series_thumbnail(series_books, thumbnail)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error updating book thumbnail: ' + str(ex))
|
self.log.debug('Error updating book thumbnail: ' + str(ex))
|
||||||
self._handleError('Error updating book thumbnail: ' + str(ex))
|
self._handleError('Error updating book thumbnail: ' + str(ex))
|
||||||
self.app_db_session.rollback()
|
self.app_db_session.rollback()
|
||||||
|
|
||||||
|
@ -393,7 +390,7 @@ class TaskGenerateSeriesThumbnails(CalibreTask):
|
||||||
canvas.composite(img, left, top)
|
canvas.composite(img, left, top)
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error generating thumbnail file: ' + str(ex))
|
self.log.debug('Error generating thumbnail file: ' + str(ex))
|
||||||
raise ex
|
raise ex
|
||||||
finally:
|
finally:
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
|
@ -450,18 +447,18 @@ class TaskClearCoverThumbnailCache(CalibreTask):
|
||||||
super(TaskClearCoverThumbnailCache, self).__init__(task_message)
|
super(TaskClearCoverThumbnailCache, self).__init__(task_message)
|
||||||
self.log = logger.create()
|
self.log = logger.create()
|
||||||
self.book_id = book_id
|
self.book_id = book_id
|
||||||
self.calibre_db = db.CalibreDB()
|
|
||||||
self.calibre_db.init_db(expire_on_commit=False)
|
|
||||||
self.app_db_session = ub.get_new_session_instance()
|
self.app_db_session = ub.get_new_session_instance()
|
||||||
self.cache = fs.FileSystem()
|
self.cache = fs.FileSystem()
|
||||||
|
|
||||||
def run(self, worker_thread):
|
def run(self, worker_thread):
|
||||||
if self.app_db_session:
|
if self.app_db_session:
|
||||||
if self.book_id == 0: # delete superfluous thumbnails
|
if self.book_id == 0: # delete superfluous thumbnails
|
||||||
thumbnails = (self.calibre_db.session.query(ub.Thumbnail)
|
calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
|
thumbnails = (calibre_db.session.query(ub.Thumbnail)
|
||||||
.join(db.Books, ub.Thumbnail.entity_id == db.Books.id, isouter=True)
|
.join(db.Books, ub.Thumbnail.entity_id == db.Books.id, isouter=True)
|
||||||
.filter(db.Books.id == None)
|
.filter(db.Books.id == None)
|
||||||
.all())
|
.all())
|
||||||
|
calibre_db.session.close()
|
||||||
elif self.book_id > 0: # make sure single book is selected
|
elif self.book_id > 0: # make sure single book is selected
|
||||||
thumbnails = self.get_thumbnails_for_book(self.book_id)
|
thumbnails = self.get_thumbnails_for_book(self.book_id)
|
||||||
if self.book_id < 0:
|
if self.book_id < 0:
|
||||||
|
@ -489,7 +486,7 @@ class TaskClearCoverThumbnailCache(CalibreTask):
|
||||||
.delete()
|
.delete()
|
||||||
self.app_db_session.commit()
|
self.app_db_session.commit()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error deleting book thumbnail: ' + str(ex))
|
self.log.debug('Error deleting book thumbnail: ' + str(ex))
|
||||||
self._handleError('Error deleting book thumbnail: ' + str(ex))
|
self._handleError('Error deleting book thumbnail: ' + str(ex))
|
||||||
|
|
||||||
def delete_all_thumbnails(self):
|
def delete_all_thumbnails(self):
|
||||||
|
@ -498,7 +495,7 @@ class TaskClearCoverThumbnailCache(CalibreTask):
|
||||||
self.app_db_session.commit()
|
self.app_db_session.commit()
|
||||||
self.cache.delete_cache_dir(constants.CACHE_TYPE_THUMBNAILS)
|
self.cache.delete_cache_dir(constants.CACHE_TYPE_THUMBNAILS)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.info('Error deleting thumbnail directory: ' + str(ex))
|
self.log.debug('Error deleting thumbnail directory: ' + str(ex))
|
||||||
self._handleError('Error deleting thumbnail directory: ' + str(ex))
|
self._handleError('Error deleting thumbnail directory: ' + str(ex))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<label for="schedule_generate_series_covers">{{_('Generate Series Cover Thumbnails')}}</label>
|
<label for="schedule_generate_series_covers">{{_('Generate Series Cover Thumbnails')}}</label>
|
||||||
</div-->
|
</div-->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="checkbox" id="schedule_reconnect" name="schedule_reconnect" {% if config.schedule_generate_book_covers %}checked{% endif %}>
|
<input type="checkbox" id="schedule_reconnect" name="schedule_reconnect" {% if config.schedule_reconnect %}checked{% endif %}>
|
||||||
<label for="schedule_reconnect">{{_('Reconnect to Calibre Library')}}</label>
|
<label for="schedule_reconnect">{{_('Reconnect to Calibre Library')}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,10 @@ class Updater(threading.Thread):
|
||||||
return self._stable_version_info()
|
return self._stable_version_info()
|
||||||
return self._nightly_version_info()
|
return self._nightly_version_info()
|
||||||
|
|
||||||
def get_available_updates(self, request_method, locale):
|
def get_available_updates(self, request_method):
|
||||||
if self.config.config_updatechannel == constants.UPDATE_STABLE:
|
if self.config.config_updatechannel == constants.UPDATE_STABLE:
|
||||||
return self._stable_available_updates(request_method)
|
return self._stable_available_updates(request_method)
|
||||||
return self._nightly_available_updates(request_method, locale)
|
return self._nightly_available_updates(request_method)
|
||||||
|
|
||||||
def do_work(self):
|
def do_work(self):
|
||||||
try:
|
try:
|
||||||
|
@ -335,7 +335,7 @@ class Updater(threading.Thread):
|
||||||
print("\n*** Finished ***")
|
print("\n*** Finished ***")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _populate_parent_commits(update_data, status, locale, tz, parents):
|
def _populate_parent_commits(update_data, status, tz, parents):
|
||||||
try:
|
try:
|
||||||
parent_commit = update_data['parents'][0]
|
parent_commit = update_data['parents'][0]
|
||||||
# limit the maximum search depth
|
# limit the maximum search depth
|
||||||
|
@ -360,7 +360,7 @@ class Updater(threading.Thread):
|
||||||
parent_commit_date = datetime.datetime.strptime(
|
parent_commit_date = datetime.datetime.strptime(
|
||||||
parent_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
|
parent_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
|
||||||
parent_commit_date = format_datetime(
|
parent_commit_date = format_datetime(
|
||||||
parent_commit_date, format='short', locale=locale)
|
parent_commit_date, format='short')
|
||||||
|
|
||||||
parents.append([parent_commit_date,
|
parents.append([parent_commit_date,
|
||||||
parent_data['message'].replace('\r\n', '<p>').replace('\n', '<p>')])
|
parent_data['message'].replace('\r\n', '<p>').replace('\n', '<p>')])
|
||||||
|
@ -418,7 +418,7 @@ class Updater(threading.Thread):
|
||||||
log_function("Excluded file list for updater not found, or not accessible")
|
log_function("Excluded file list for updater not found, or not accessible")
|
||||||
return excluded_files
|
return excluded_files
|
||||||
|
|
||||||
def _nightly_available_updates(self, request_method, locale):
|
def _nightly_available_updates(self, request_method):
|
||||||
tz = datetime.timedelta(seconds=time.timezone if (time.localtime().tm_isdst == 0) else time.altzone)
|
tz = datetime.timedelta(seconds=time.timezone if (time.localtime().tm_isdst == 0) else time.altzone)
|
||||||
if request_method == "GET":
|
if request_method == "GET":
|
||||||
repository_url = _REPOSITORY_API_URL
|
repository_url = _REPOSITORY_API_URL
|
||||||
|
@ -459,14 +459,14 @@ class Updater(threading.Thread):
|
||||||
update_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
|
update_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
|
||||||
parents.append(
|
parents.append(
|
||||||
[
|
[
|
||||||
format_datetime(new_commit_date, format='short', locale=locale),
|
format_datetime(new_commit_date, format='short'),
|
||||||
update_data['message'],
|
update_data['message'],
|
||||||
update_data['sha']
|
update_data['sha']
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# it only makes sense to analyze the parents if we know the current commit hash
|
# it only makes sense to analyze the parents if we know the current commit hash
|
||||||
if status['current_commit_hash'] != '':
|
if status['current_commit_hash'] != '':
|
||||||
parents = self._populate_parent_commits(update_data, status, locale, tz, parents)
|
parents = self._populate_parent_commits(update_data, status, tz, parents)
|
||||||
status['history'] = parents[::-1]
|
status['history'] = parents[::-1]
|
||||||
except (IndexError, KeyError):
|
except (IndexError, KeyError):
|
||||||
status['success'] = False
|
status['success'] = False
|
||||||
|
@ -595,7 +595,7 @@ class Updater(threading.Thread):
|
||||||
return json.dumps(status)
|
return json.dumps(status)
|
||||||
|
|
||||||
def _get_request_path(self):
|
def _get_request_path(self):
|
||||||
if config.config_updatechannel == constants.UPDATE_STABLE:
|
if self.config.config_updatechannel == constants.UPDATE_STABLE:
|
||||||
return self.updateFile
|
return self.updateFile
|
||||||
return _REPOSITORY_API_URL + '/zipball/master'
|
return _REPOSITORY_API_URL + '/zipball/master'
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ class Updater(threading.Thread):
|
||||||
status['message'] = _(u'HTTP Error') + ': ' + commit['message']
|
status['message'] = _(u'HTTP Error') + ': ' + commit['message']
|
||||||
else:
|
else:
|
||||||
status['message'] = _(u'HTTP Error') + ': ' + str(e)
|
status['message'] = _(u'HTTP Error') + ': ' + str(e)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError as e:
|
||||||
status['message'] = _(u'Connection error')
|
status['message'] = _(u'Connection error')
|
||||||
except requests.exceptions.Timeout:
|
except requests.exceptions.Timeout:
|
||||||
status['message'] = _(u'Timeout while establishing connection')
|
status['message'] = _(u'Timeout while establishing connection')
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user