routing.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:oa_qian 作者: sunqb 项目源码 文件源码
def test_redirect_path_quoting(self):
        url_map = r.Map([
            r.Rule('/<category>', defaults={'page': 1}, endpoint='category'),
            r.Rule('/<category>/page/<int:page>', endpoint='category')
        ])

        adapter = url_map.bind('example.com')
        try:
            adapter.match('/foo bar/page/1')
        except r.RequestRedirect as e:
            response = e.get_response({})
            self.assert_strict_equal(response.headers['location'],
                                     u'http://example.com/foo%20bar')
        else:
            self.fail('Expected redirect')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号