本文整理汇总了Python中werkzeug.exceptions.HTTPException.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPException.__init__方法的具体用法?Python HTTPException.__init__怎么用?Python HTTPException.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类werkzeug.exceptions.HTTPException
的用法示例。
在下文中一共展示了HTTPException.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, data, description=None):
"""
param: data: A dictionary containing the field errors that occured
param: description: Optional description to send through
"""
HTTPException.__init__(self)
self.data = data
示例2: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, description, locator="", code=400):
self.code = code
self.description = description
self.locator = locator
logging.exception(description)
HTTPException.__init__(self)
示例3: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, description, locator="", code=400):
self.code = code
self.description = description
self.locator = locator
msg = 'Exception: code: %s, locator: %s, description: %s' % (self.code, self.description, self.locator)
LOGGER.exception(msg)
HTTPException.__init__(self)
示例4: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(message=None, data=None, code=400, **kwargs):
data = data or kwargs
if instanceof(message, str):
data, message = message, None
if message:
data["message"] = message
response = jsonify(status="fail", data=data)
response.status_code = status_code
HTTPException.__init__(self, message, response)
self.code = code
示例5: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, message=''):
# HTTPException has its own custom __init__ method, but we want the
# usual "First argument is the message" behavior.
HTTPException.__init__(self)
self.message = message
示例6: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, code, description):
HTTPException.__init__(self)
self.code = code
self.description = description
示例7: init
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def init(self, description=None, response=None, traceback=None):
self.traceback = traceback
HTTPException.__init__(self, description, response)
示例8: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, valid_methods=None, description=None):
"""Takes an optional list of valid http methods
starting with werkzeug 0.3 the list will be mandatory."""
HTTPException.__init__(self, description)
self.valid_methods = valid_methods
示例9: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, location):
HTTPException.__init__(self)
self.location = location
示例10: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, message="Internal Error", response=None):
if WERKZEUG:
HTTPException.__init__(self, message, response)
else:
self.description = message
self.response = response
示例11: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__ (self, detail='not Found', status=404):
HTTPException.__init__ (self)
self.detail = detail
self.status = status
示例12: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, message, code=None):
HTTPException.__init__(self, message)
if code is not None:
self.code = code
示例13: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, _server_id, _database_name, _conn_id):
self.sid = _server_id
self.db = _database_name
self.conn_id = _conn_id
HTTPException.__init__(self)
示例14: __init__
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, article_name, original_link, description=None):
HTTPException.__init__(self, description)
self.article_name = article_name
self.original_link = original_link