本文整理汇总了Python中stackinabox.stack.StackInABox.call方法的典型用法代码示例。如果您正苦于以下问题:Python StackInABox.call方法的具体用法?Python StackInABox.call怎么用?Python StackInABox.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stackinabox.stack.StackInABox
的用法示例。
在下文中一共展示了StackInABox.call方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: App
# 需要导入模块: from stackinabox.stack import StackInABox [as 别名]
# 或者: from stackinabox.stack.StackInABox import call [as 别名]
#.........这里部分代码省略.........
526: "Invalid SSL Certificate",
# The below codes are specific cases for the infrastructure
# supported here and should not conflict with anything above.
# StackInABox Status Codes
595: "Route Not Handled",
596: "Unhandled Exception",
597: "URI Is For Service That Is Unknown",
# StackInAWSGI Status Codes
593: "Session ID Missing from URI",
594: "Invalid Session ID"
}
def __init__(self, services=None):
"""
Create the WSGI Application
:param list services: list of :obj:`StackInABoxService`s to load into
StackInABox.
"""
self.stackinabox = StackInABox()
self.stack_service = StackInAWsgiSessionManager()
self.admin_service = StackInAWsgiAdmin(
self.stack_service,
'http://localhost/stackinabox/'
)
self.stackinabox.register(self.admin_service)
self.stackinabox.register(self.stack_service)
def __check_service(service_object):
"""
Simple wrapper to check whether an object provide by the caller is
a StackInABoxService by creating an instance
"""
svc = service_object()
if not isinstance(svc, StackInABoxService):
raise TypeError(
"Service is not a Stack-In-A-Box Service"
)
# if the caller does not provide any services then just log it
# to keep from user confusion
if services is not None:
# Allow the caller to provide either an iterable of services to
# to provide to the session or to provide a single service object
if isinstance(services, Iterable):
# for each service verify it is a StackInABoxService
for service in services:
__check_service(service)
self.RegisterWithStackInABox(service)
else:
# if it's not an iterable - e.g a single object - then
# just check the variable itself
__check_service(services)
self.RegisterWithStackInABox(services)
else:
logger.debug(
"No services registered on initialization"
)
def RegisterWithStackInABox(self, service):