diff --git a/nilmdb/server/server.py b/nilmdb/server/server.py index 3eac639..3fc06cb 100644 --- a/nilmdb/server/server.py +++ b/nilmdb/server/server.py @@ -20,7 +20,6 @@ import traceback from nilmdb.server.serverutil import ( chunked_response, response_type, - workaround_cp_bug_1200, exception_to_httperror, CORS_allow, json_to_request_params, @@ -282,7 +281,6 @@ class Stream(NilmApp): if len(self.db.stream_list(path = path)) != 1: raise cherrypy.HTTPError("404", "No such stream: " + path) - @workaround_cp_bug_1200 def content(start, end): # Note: disable chunked responses to see tracebacks from here. while True: @@ -322,7 +320,6 @@ class Stream(NilmApp): if diffpath and len(self.db.stream_list(path = diffpath)) != 1: raise cherrypy.HTTPError("404", "No such stream: " + diffpath) - @workaround_cp_bug_1200 def content(start, end): # Note: disable chunked responses to see tracebacks from here. while True: @@ -375,7 +372,6 @@ class Stream(NilmApp): content_type = "text/plain" cherrypy.response.headers['Content-Type'] = content_type - @workaround_cp_bug_1200 def content(start, end): # Note: disable chunked responses to see tracebacks from here. if count: diff --git a/nilmdb/server/serverutil.py b/nilmdb/server/serverutil.py index 902618b..f8a56f6 100644 --- a/nilmdb/server/serverutil.py +++ b/nilmdb/server/serverutil.py @@ -38,28 +38,6 @@ def response_type(content_type): return func(*args, **kwargs) return decorator.decorator(wrapper) -@decorator.decorator -def workaround_cp_bug_1200(func, *args, **kwargs): # pragma: no cover - """Decorator to work around CherryPy bug #1200 in a response - generator. - - Even if chunked responses are disabled, LookupError or - UnicodeError exceptions may still be swallowed by CherryPy due to - bug #1200. This throws them as generic Exceptions instead so that - they make it through. - """ - exc_info = None - try: - for val in func(*args, **kwargs): - yield val - except (LookupError, UnicodeError): - # Re-raise it, but maintain the original traceback - exc_info = sys.exc_info() - new_exc = Exception(exc_info[0].__name__ + ": " + str(exc_info[1])) - raise new_exc.with_traceback(exc_info[2]) - finally: - del exc_info - def exception_to_httperror(*expected): """Return a decorator-generating function that catches expected errors and throws a HTTPError describing it instead.