diff --git a/HACKS.txt b/HACKS.txt deleted file mode 100644 index 8750d457..00000000 --- a/HACKS.txt +++ /dev/null @@ -1,3 +0,0 @@ -Libs with customisations... - -/tornado diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 4c45f39e..319e00c6 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -619,7 +619,8 @@ def initialize(consoleLogging=True): ANON_REDIRECT = check_setting_str(CFG, 'General', 'anon_redirect', 'http://dereferer.org/?') PROXY_SETTING = check_setting_str(CFG, 'General', 'proxy_setting', '') PROXY_INDEXERS = bool(check_setting_int(CFG, 'General', 'proxy_indexers', 1)) - # attempt to help prevent users from breaking links by using a bad url + + # attempt to help prevent users from breaking links by using a bad url if not ANON_REDIRECT.endswith('?'): ANON_REDIRECT = '' diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index 9e962f8a..a34e9c0c 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -165,16 +165,14 @@ class Api(webserve.MainHandler): self.set_header("Content-Type", "application/json") try: out = json.dumps(dict, indent=self.intent, ensure_ascii=False, sort_keys=True) - if 'jsonp' in self.request.query_arguments: - out = self.request.arguments['jsonp'] + '(' + out + ');' # wrap with JSONP call if requested - + callback = self.request.headers.get('callback', None) or self.request.headers.get('jsonp', None) + if callback != None: + out = callback + '(' + out + ');' # wrap with JSONP call if requested except Exception, e: # if we fail to generate the output fake an error logger.log(u"API :: " + traceback.format_exc(), logger.DEBUG) out = '{"result":"' + result_type_map[RESULT_ERROR] + '", "message": "error while composing output: "' + ex( e) + '"}' - - tornado_write_hack_dict = {'unwrap_json': out} - return tornado_write_hack_dict + return out def _grand_access(self, realKey, args, kwargs): """ validate api key and log result """ diff --git a/tornado/http1connection.py b/tornado/http1connection.py index 8a5f46c4..90895cc9 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -686,9 +686,8 @@ class HTTP1ServerConnection(object): # This exception was already logged. conn.close() return - except Exception as e: - if 1 != e.errno: - gen_log.error("Uncaught exception", exc_info=True) + except Exception: + gen_log.error("Uncaught exception", exc_info=True) conn.close() return if not ret: diff --git a/tornado/iostream.py b/tornado/iostream.py index 69f43957..eced6d64 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -601,9 +601,8 @@ class BaseIOStream(object): pos = self._read_to_buffer_loop() except UnsatisfiableReadError: raise - except Exception as e: - if 1 != e.errno: - gen_log.warning("error on read", exc_info=True) + except Exception: + gen_log.warning("error on read", exc_info=True) self.close(exc_info=True) return if pos is not None: diff --git a/tornado/web.py b/tornado/web.py index 9edd719a..a038265f 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -652,10 +652,7 @@ class RequestHandler(object): if not isinstance(chunk, (bytes, unicode_type, dict)): raise TypeError("write() only accepts bytes, unicode, and dict objects") if isinstance(chunk, dict): - if 'unwrap_json' in chunk: - chunk = chunk['unwrap_json'] - else: - chunk = escape.json_encode(chunk) + chunk = escape.json_encode(chunk) self.set_header("Content-Type", "application/json; charset=UTF-8") chunk = utf8(chunk) self._write_buffer.append(chunk)