本文整理汇总了Python中wsmeext.pecan.wsexpose方法的典型用法代码示例。如果您正苦于以下问题:Python pecan.wsexpose方法的具体用法?Python pecan.wsexpose怎么用?Python pecan.wsexpose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wsmeext.pecan
的用法示例。
在下文中一共展示了pecan.wsexpose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expose
# 需要导入模块: from wsmeext import pecan [as 别名]
# 或者: from wsmeext.pecan import wsexpose [as 别名]
def expose(*args, **kwargs):
"""Ensure that only JSON, and not XML, is supported."""
if 'rest_content_types' not in kwargs:
kwargs['rest_content_types'] = ('json',)
return wsme_pecan.wsexpose(*args, **kwargs)
示例2: setup_fake_modules
# 需要导入模块: from wsmeext import pecan [as 别名]
# 或者: from wsmeext.pecan import wsexpose [as 别名]
def setup_fake_modules(self):
class FakeConfigController(rating.RatingRestControllerBase):
_custom_actions = {
'test': ['GET']
}
@wsme_pecan.wsexpose(wtypes.text)
def get_test(self):
"""Return the list of every mapping type available.
"""
return 'OK'
fake_module1 = tests.FakeRatingModule()
fake_module1.module_name = 'fake1'
fake_module1.set_priority(3)
fake_module2 = tests.FakeRatingModule()
fake_module2.module_name = 'fake2'
fake_module2.config_controller = FakeConfigController
fake_module2.set_priority(1)
fake_module3 = tests.FakeRatingModule()
fake_module3.module_name = 'fake3'
fake_module3.set_priority(2)
fake_extensions = [
extension.Extension(
'fake1',
'cloudkitty.tests.FakeRatingModule1',
None,
fake_module1),
extension.Extension(
'fake2',
'cloudkitty.tests.FakeRatingModule2',
None,
fake_module2),
extension.Extension(
'fake3',
'cloudkitty.tests.FakeRatingModule3',
None,
fake_module3)]
return fake_extensions
示例3: expose
# 需要导入模块: from wsmeext import pecan [as 别名]
# 或者: from wsmeext.pecan import wsexpose [as 别名]
def expose(*args, **kwargs):
"""Ensure that only JSON, and not XML, is supported."""
if 'rest_content_types' not in kwargs:
kwargs['rest_content_types'] = ('json',)
# Set the HTTP Response Content-Type is JSON in header.
return wsme_pecan.wsexpose(*args, **kwargs)
示例4: expose
# 需要导入模块: from wsmeext import pecan [as 别名]
# 或者: from wsmeext.pecan import wsexpose [as 别名]
def expose(*args, **kwargs):
"""Ensure that only JSON, and not XML, is supported."""
if 'rest_content_types' not in kwargs:
kwargs['rest_content_types'] = ('json',)
return wsme_pecan.wsexpose(*args, **kwargs)