当前位置: 首页>>代码示例>>Python>>正文


Python Response.force_type方法代码示例

本文整理汇总了Python中werkzeug.Response.force_type方法的典型用法代码示例。如果您正苦于以下问题:Python Response.force_type方法的具体用法?Python Response.force_type怎么用?Python Response.force_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在werkzeug.Response的用法示例。


在下文中一共展示了Response.force_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: finalize_response

# 需要导入模块: from werkzeug import Response [as 别名]
# 或者: from werkzeug.Response import force_type [as 别名]
def finalize_response(request, response):
    """Finalizes the response.  Applies common response processors."""
    if not isinstance(response, Response):
        response = Response.force_type(response, request.environ)
    if response.status == 200:
        response.add_etag()
        response = response.make_conditional(request)
    before_response_sent.emit(request=request, response=response)
    return response
开发者ID:amadev,项目名称:rater,代码行数:11,代码来源:application.py

示例2: process_view_result

# 需要导入模块: from werkzeug import Response [as 别名]
# 或者: from werkzeug.Response import force_type [as 别名]
 def process_view_result(self, rv):
     """Processes a view's return value and ensures it's a response
     object.  This is automatically called by the dispatch function
     but is also handy for view decorators.
     """
     if isinstance(rv, basestring):
         rv = Response(rv, mimetype='text/html')
     elif not isinstance(rv, Response):
         rv = Response.force_type(rv, self.environ)
     return rv
开发者ID:amadev,项目名称:rater,代码行数:12,代码来源:application.py

示例3: test_easteregg

# 需要导入模块: from werkzeug import Response [as 别名]
# 或者: from werkzeug.Response import force_type [as 别名]
def test_easteregg():
    """Make sure the easteregg runs"""
    req = Request.from_values('/?macgybarchakku')
    resp = Response.force_type(internal._easteregg(None), req)
    assert 'About Werkzeug' in resp.data
    assert 'the Swiss Army knife of Python web development' in resp.data
开发者ID:marchon,项目名称:checkinmapper,代码行数:8,代码来源:test_internal.py


注:本文中的werkzeug.Response.force_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。