From 340bcffc915848a611eefb3bc254ddcb491782ac Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 18 Dec 2014 13:59:47 -0800 Subject: [PATCH] Fix for sickragetv/sickrage-issues#164 - ensures result.hash is never NoneType for when attempting to raise exceptions. --- sickbeard/classes.py | 23 +++++++++++++++-------- sickbeard/clients/generic.py | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sickbeard/classes.py b/sickbeard/classes.py index 9e3fcddf..7a0420a5 100644 --- a/sickbeard/classes.py +++ b/sickbeard/classes.py @@ -106,6 +106,12 @@ class SearchResult: # version self.version = -1 + # hash + self.hash = "" + + # content + self.content = "" + def __str__(self): if self.provider is None: @@ -148,10 +154,6 @@ class TorrentSearchResult(SearchResult): """ resultType = "torrent" - # torrent hash - content = None - hash = None - class AllShowsListUI: """ @@ -266,15 +268,20 @@ class ErrorViewer(): def get(): return ErrorViewer.errors + class UIError(): """ Represents an error to be displayed in the web UI. """ def __init__(self, message): - try:self.title = sys.exc_info()[1].message - except:self.title = None + try: + self.title = sys.exc_info()[1].message + except: + self.title = None self.message = message self.time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - try:self.exc_info = sys.exc_info() - except:self.exc_info = None + try: + self.exc_info = sys.exc_info() + except: + self.exc_info = None diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index 81937841..417e7eb2 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -198,7 +198,7 @@ class GenericClient(object): logger.log(self.name + u': Unable to set priority for Torrent', logger.ERROR) except Exception, e: - logger.log(self.name + u': Failed Sending Torrent: ' + result.name + ' - ' + result.hash, logger.ERROR) + logger.log(self.name + u': Failed Sending Torrent: ' + str(result.name) + ' - ' + str(result.hash), logger.ERROR) logger.log(self.name + u': Exception raised when sending torrent: ' + ex(e), logger.DEBUG) return r_code