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


Python HttpRequest.GET['format']方法代码示例

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


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

示例1: test_xml_parameter_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_xml_parameter_get(self):
     req = HttpRequest()
     req.GET['format'] = '1'
     resp = widget(lambda r: "test")(req)
     self.assertEqual('<?xml version="1.0" ?><root>test</root>',
             resp.content)
     self.assertEqual(resp._headers['content-type'], ('Content-Type', 'application/xml'))
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例2: test_encrypted_json_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_encrypted_json_get(self):
     req = HttpRequest()
     req.GET['format'] = '2'
     resp = widget(encrypted=True)(lambda r: "test")(req)
     self.assertNotEqual('"test"', resp.content)
     self.assertEqual(44, len(resp.content))
     self.assertEqual(resp._headers['content-type'], ('Content-Type', 'application/json'))
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例3: test10_test_format

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test10_test_format(self):
     request = HttpRequest()
     request.method = 'GET'
     request.GET['format'] = 'json'
     cr = CustomAPIResource()
     the_ret = cr.get_schema(request)
     self.assertEqual(
         the_ret._headers['content-type'][1],
         'application/json; charset=utf-8')
开发者ID:rtucker-mozilla,项目名称:mozilla_inventory,代码行数:11,代码来源:tests.py

示例4: test_encrypted_xml_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_encrypted_xml_get(self):
     req = HttpRequest()
     req.GET['format'] = '1'
     self.assertRaises(ValueError, widget(encrypted=True)(lambda r: "test"), req)
开发者ID:Mondego,项目名称:pyreco,代码行数:6,代码来源:allPythonContent.py

示例5: test_json_parameter_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_json_parameter_get(self):
     req = HttpRequest()
     req.GET['format'] = '2'
     resp = widget(lambda r: "test")(req)
     self.assertEqual('"test"', resp.content)
     self.assertEqual(resp._headers['content-type'], ('Content-Type', 'application/json'))
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py

示例6: test_json_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_json_get(self):
     req = HttpRequest()
     req.GET['format'] = '2'
     resp = widget(lambda r: "test")(req)
     self.assertEqual('"test"', resp.content)
开发者ID:CashStar,项目名称:django-geckoboard,代码行数:7,代码来源:test_decorators.py

示例7: test_xml_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import GET['format'] [as 别名]
 def test_xml_get(self):
     req = HttpRequest()
     req.GET['format'] = '1'
     resp = widget(lambda r: "test")(req)
     self.assertEqual('<?xml version="1.0" ?><root>test</root>',
             resp.content)
开发者ID:CashStar,项目名称:django-geckoboard,代码行数:8,代码来源:test_decorators.py


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