本文整理汇总了Python中webob.response.Response.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Response.__init__方法的具体用法?Python Response.__init__怎么用?Python Response.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webob.response.Response
的用法示例。
在下文中一共展示了Response.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import __init__ [as 别名]
def __init__(
self,
detail=None,
headers=None,
comment=None,
body_template=None,
json_formatter=None,
**kw
):
Response.__init__(self, status="%s %s" % (self.code, self.title), **kw)
Exception.__init__(self, detail)
if headers:
self.headers.extend(headers)
self.detail = detail
self.comment = comment
if body_template is not None:
self.body_template = body_template
self.body_template_obj = Template(body_template)
if self.empty_body:
del self.content_type
del self.content_length
if json_formatter is not None:
self.json_formatter = json_formatter
示例2: __init__
# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import __init__ [as 别名]
def __init__(self, detail=None, headers=None, title=None, comment=None, explanation=None, **kw):
Response.__init__(self,
status='%s %s' % (self.code, self.title),
**kw)
Exception.__init__(self, detail)
if headers:
self.headers.extend(headers)
self.title = title or self.title
self.detail = detail
self.comment = comment
self.explanation = explanation or self.explanation
if self.empty_body:
del self.content_type
del self.content_length
示例3: __init__
# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import __init__ [as 别名]
def __init__(self, msg=u'Not Found.'):
body = {'status': 404, 'message': msg}
Response.__init__(self, json.dumps(body))
self.status = 404
self.content_type = 'application/json'
示例4: __init__
# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import __init__ [as 别名]
def __init__(self, message='Exception'):
Response.__init__(self, status=self.status)
Exception.__init__(self, message)