Fix for sickragetv/sickrage-issues#164 - ensures result.hash is never NoneType for when attempting to raise exceptions.

This commit is contained in:
echel0n 2014-12-18 13:59:47 -08:00
parent 042c3f4287
commit 340bcffc91
2 changed files with 16 additions and 9 deletions

View File

@ -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

View File

@ -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