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


Python Configuration.scope方法代码示例

本文整理汇总了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
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:protocol.py

示例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)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:35,代码来源:requestHandler.py

示例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]})
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:17,代码来源:protocol.py


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