Don't error out on empty date

This commit is contained in:
Ruud
2015-02-22 18:07:43 +01:00
parent 0bd953409e
commit 965b8089f1

View File

@@ -79,7 +79,9 @@ class Updater(Plugin):
try: try:
if self.conf('notification'): if self.conf('notification'):
info = self.updater.info() info = self.updater.info()
version_date = datetime.fromtimestamp(info['update_version']['date']) version_date = 'the future!'
if info['update_version']['date']:
version_date = datetime.fromtimestamp(info['update_version']['date'])
fireEvent('updater.updated', 'Updated to a new version with hash "%s", this version is from %s' % (info['update_version']['hash'], version_date), data = info) fireEvent('updater.updated', 'Updated to a new version with hash "%s", this version is from %s' % (info['update_version']['hash'], version_date), data = info)
except: except:
log.error('Failed notifying for update: %s', traceback.format_exc()) log.error('Failed notifying for update: %s', traceback.format_exc())
@@ -97,7 +99,9 @@ class Updater(Plugin):
if self.updater.check(): if self.updater.check():
if not self.available_notified and self.conf('notification') and not self.conf('automatic'): if not self.available_notified and self.conf('notification') and not self.conf('automatic'):
info = self.updater.info() info = self.updater.info()
version_date = datetime.fromtimestamp(info['update_version']['date']) version_date = 'the future!'
if info['update_version']['date']:
version_date = datetime.fromtimestamp(info['update_version']['date'])
fireEvent('updater.available', message = 'A new update with hash "%s" is available, this version is from %s' % (info['update_version']['hash'], version_date), data = info) fireEvent('updater.available', message = 'A new update with hash "%s" is available, this version is from %s' % (info['update_version']['hash'], version_date), data = info)
self.available_notified = True self.available_notified = True
return True return True