本文整理匯總了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)