Python tornado.web 模块,ErrorHandler() 实例源码

我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用tornado.web.ErrorHandler()

项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:My-Web-Server-Framework-With-Python2.7    作者:syjsu    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:My-Web-Server-Framework-With-Python2.7    作者:syjsu    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:get_started_with_respeaker    作者:respeaker    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:projects-2017-2    作者:ncss    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:projects-2017-2    作者:ncss    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:aweasome_learning    作者:Knight-ZXW    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:aweasome_learning    作者:Knight-ZXW    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:PyQYT    作者:collinsctk    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:PyQYT    作者:collinsctk    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
def get_handlers(self):
        # note that if the handlers list is empty we get the default_host
        # redirect fallback instead of a 404, so test with both an
        # explicitly defined error handler and an implicit 404.
        return [('/error', ErrorHandler, dict(status_code=417))]
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
def get_app_kwargs(self):
        return dict(default_handler_class=ErrorHandler,
                    default_handler_args=dict(status_code=403))
项目:tornadopy    作者:xubigshu    | 项目源码 | 文件源码
def _execute_module(self, handler, clear, module, method, name=None, **kwargs):
        try:
            def run_method_():
                if method.__name__ == "begin_response":
                    return method(handler, clear, kwargs.pop("chunk", None))
                elif method.__name__ == "begin_render":
                    return method(handler, clear, **kwargs)
                elif method.__name__ == 'begin_request':
                    return method(handler, clear)
                elif method.__name__ == 'complete_response':
                    return method(handler, clear)

            if name:
                if hasattr(handler, 'pattern__'):
                    patt = handler.pattern__

                    if name == patt:
                        url_spec = self.named_handlers.get(name, None)
                        if url_spec:
                            if isinstance(handler, url_spec.handler_class):
                                return run_method_()
                    elif handler.request.re_match_table[name]:
                        return run_method_()

            else:
                pattern__ = getattr(handler, 'pattern__', None)

                def check_(key):
                    non_execute = self.non_executes_modules.get(key, [])
                    if non_execute:
                        for n in non_execute:
                            if isinstance(module, n):
                                return True

                if pattern__ in self.non_executes_modules:
                    if check_(handler.pattern__): return

                if hasattr(handler.request, 're_match_table') and handler.request.re_match_table:
                    for key, match in handler.request.re_match_table.items():
                        if match:
                            if check_(key): return

                if not isinstance(handler, ErrorHandler):
                    return run_method_()

        except BaseException, ex:
            raise