本文整理匯總了Python中werkzeug.exceptions.HTTPException.__subclasses__方法的典型用法代碼示例。如果您正苦於以下問題:Python HTTPException.__subclasses__方法的具體用法?Python HTTPException.__subclasses__怎麽用?Python HTTPException.__subclasses__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類werkzeug.exceptions.HTTPException
的用法示例。
在下文中一共展示了HTTPException.__subclasses__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_app
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __subclasses__ [as 別名]
def create_app(settings_override=None, register_security_blueprint=False):
app = factory.create_app(__name__, __path__, settings_override, register_security_blueprint)
# Init API endpoints for models
api_manager.init_app(app)
# Setup security async email send
security_ctx = app.extensions['security']
@security_ctx.send_mail_task
def delay_security_email(msg): # pylint: disable=unused-variable
tasks.send_security_email.delay(msg)
# Register custom error handlers so they all return JSON
if not app.debug:
for http_exception_class in HTTPException.__subclasses__():
app.errorhandler(http_exception_class.code)(handle_error)
return app