本文整理汇总了Python中SkunkWeb.Configuration.scope方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.scope方法的具体用法?Python Configuration.scope怎么用?Python Configuration.scope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkunkWeb.Configuration
的用法示例。
在下文中一共展示了Configuration.scope方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _processRequest
# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import scope [as 别名]
def _processRequest(requestData, sessionDict):
"""
request handling functioning for requestHandler's
HandleRequest hook.
"""
response=None
# DEBUG(WEB, 'creating Connection')
# DEBUG(WEB, 'requestData is %s' % str(requestData))
connection=HTTPConnection(requestData)
sessionDict[constants.CONNECTION]=connection
sessionDict[constants.HOST]=connection.host
sessionDict[constants.LOCATION]=connection.uri
sessionDict[constants.SERVER_PORT]=int(connection.env['SERVER_PORT'])
try:
# DEBUG(WEB, 'executing HaveConnection hook')
HaveConnection(Configuration.job, connection, sessionDict)
# DEBUG(WEB, 'survived HaveConnection hook')
# overlay of config information
Configuration.trim()
Configuration.scope(sessionDict)
#Configuration.saveMash()
# DEBUG(WEB, 'executing PreHandleConnection hook')
PreHandleConnection(Configuration.job, connection, sessionDict)
except PreemptiveResponse, pr:
# DEBUG(WEB, 'got preemptive response')
response=pr.responseData
示例2: _beginSession
# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import scope [as 别名]
def _beginSession(sock, sessionDict):
# capture the ip & port (or path, for a unix socket)
# on which the request came, for scoping of configuration
# data on their basis
ip, port, unixpath=None, None, None
try:
addr=sock.getsockname()
if type(addr)==types.TupleType:
ip, port=addr
else:
unixpath=addr
except:
ERROR("failed to read addr off socket!")
logException()
raise
if ip and port:
sessionDict[constants.IP]=ip
sessionDict[constants.PORT]=port
else:
sessionDict[constants.UNIXPATH]=unixpath
# get configuration data for the job
Configuration.scope(sessionDict)
# job must be defined, or else die here
if Configuration.job==None:
message="No job specified for service on %s:%d, "\
"request cannot be processed!" % (ip, port)
ERROR(message)
raise SkunkCriticalError, message
BeginSession(Configuration.job, sock, sessionDict)
示例3: _cleanupConfig
# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import scope [as 别名]
def _cleanupConfig(requestData, sessionDict):
"""
function for requestHandler's CleanupRequest hook
"""
if sessionDict.has_key(constants.HOST):
del sessionDict[constants.HOST]
if sessionDict.has_key(constants.LOCATION):
del sessionDict[constants.LOCATION]
Configuration.trim()
if sessionDict.has_key(constants.IP):
Configuration.scope({constants.IP : sessionDict[constants.IP],
constants.PORT: sessionDict[constants.PORT]})
elif sessionDict.has_key(constants.UNIXPATH):
Configuration.scope({constants.UNIXPATH : sessionDict[constants.UNIXPATH]})