Fix for nullhandler issues for py2.6 users,

Fix for rsstorrents.
This commit is contained in:
echel0n 2014-06-17 08:36:46 -07:00
parent 1ba2b36c93
commit 98ff924b1c
3 changed files with 27 additions and 33 deletions

View file

@ -48,6 +48,10 @@ reverseNames = {u'ERROR': ERROR,
u'DEBUG': DEBUG,
u'DB': DB}
# send logging to null
class NullHandler(logging.Handler):
def emit(self, record):
pass
class SBRotatingLogHandler(object):
def __init__(self, log_file, num_files, num_bytes):
@ -143,8 +147,7 @@ class SBRotatingLogHandler(object):
logging.getLogger('subliminal').setLevel(log_level)
logging.getLogger('imdbpy').setLevel(log_level)
# send logging to null
logging.getLogger('tornado.access').addHandler(logging.NullHandler())
logging.getLogger('tornado.access').addHandler(NullHandler())
# already logging in new log folder, close the old handler
if old_handler:

View file

@ -50,7 +50,7 @@ class TorrentRssProvider(generic.TorrentProvider):
if cookies:
self.cookies = cookies
else:
self.cookies = None
self.cookies = ''
def configStr(self):
return self.name + '|' + self.url + '|' + self.cookies + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(int(self.backlog_only))

View file

@ -23,6 +23,7 @@ import inspect
import os.path
import time
import traceback
import urllib
import re
import threading
@ -200,33 +201,27 @@ class IndexHandler(RedirectHandler):
if self.request.uri != ('/'):
raise HTTPError(404)
def get_response(self):
raise gen.Return('hello')
def get_current_user(self):
return self.get_secure_cookie("user")
@authenticated
@asynchronous
@gen.coroutine
def get(self, *args, **kwargs):
try:
resp = yield self.get_response()
self.finish(resp)
except Exception as e:
logger.log(e, logger.ERROR)
self.finish()
@gen.coroutine
def get_response(self):
raise gen.Return(self._dispatch())
def post(self, *args, **kwargs):
try:
self.finish(self._dispatch())
except Exception as e:
logger.log(e, logger.ERROR)
self.finish()
logger.log(ex(e), logger.ERROR)
logger.log(u"Traceback: " + traceback.format_exc(), logger.DEBUG)
self.finish(ex(e))
def post(self, *args, **kwargs):
try:
resp = self._dispatch()
self.finish(resp)
except Exception as e:
logger.log(ex(e), logger.ERROR)
logger.log(u"Traceback: " + traceback.format_exc(), logger.DEBUG)
self.finish(ex(e))
def robots_txt(self, *args, **kwargs):
""" Keep web crawlers out """
@ -550,7 +545,6 @@ def _getEpisode(show, season=None, episode=None, absolute=None):
return epObj
def ManageMenu():
manageMenu = [
{'title': 'Backlog Overview', 'path': 'manage/backlogOverview/'},
@ -625,17 +619,6 @@ class ManageSearches(IndexHandler):
self.redirect("/manage/manageSearches/")
def forceVersionCheck(self, *args, **kwargs):
# force a check to see if there is a new version
result = sickbeard.versionCheckScheduler.action.check_for_new_version(force=True) # @UndefinedVariable
if result:
logger.log(u"Forcing version check")
self.redirect("/manage/manageSearches/")
class Manage(IndexHandler):
def index(self, *args, **kwargs):
t = PageTemplate(file="manage.tmpl")
@ -2485,6 +2468,14 @@ class HomePostProcess(IndexHandler):
return _munge(t)
def forceVersionCheck(self, *args, **kwargs):
# force a check to see if there is a new version
if sickbeard.versionCheckScheduler.action.check_for_new_version(force=True):
logger.log(u"Forcing version check")
self.redirect("/home/")
def processEpisode(self, dir=None, nzbName=None, jobName=None, quiet=None, process_method=None, force=None,
is_priority=None, failed="0", type="auto"):