當前位置: 首頁>>代碼示例>>Python>>正文


Python apache.AP_MPMQ_IS_THREADED屬性代碼示例

本文整理匯總了Python中mod_python.apache.AP_MPMQ_IS_THREADED屬性的典型用法代碼示例。如果您正苦於以下問題:Python apache.AP_MPMQ_IS_THREADED屬性的具體用法?Python apache.AP_MPMQ_IS_THREADED怎麽用?Python apache.AP_MPMQ_IS_THREADED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在mod_python.apache的用法示例。


在下文中一共展示了apache.AP_MPMQ_IS_THREADED屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from mod_python import apache [as 別名]
# 或者: from mod_python.apache import AP_MPMQ_IS_THREADED [as 別名]
def __init__(self, req):
        self.started = False
        
        options = req.get_options()
        
        # Threading and forking
        try:
            q = apache.mpm_query
            threaded = q(apache.AP_MPMQ_IS_THREADED)
            forked = q(apache.AP_MPMQ_IS_FORKED)
        except AttributeError:
            threaded = options.get('multithread', '').lower()
            if threaded == 'on':
                threaded = True
            elif threaded == 'off':
                threaded = False
            else:
                raise ValueError(bad_value % "multithread")
            
            forked = options.get('multiprocess', '').lower()
            if forked == 'on':
                forked = True
            elif forked == 'off':
                forked = False
            else:
                raise ValueError(bad_value % "multiprocess")
        
        env = self.environ = dict(apache.build_cgi_env(req))
        
        if 'SCRIPT_NAME' in options:
            # Override SCRIPT_NAME and PATH_INFO if requested.
            env['SCRIPT_NAME'] = options['SCRIPT_NAME']
            env['PATH_INFO'] = req.uri[len(options['SCRIPT_NAME']):]
        else:
            env['SCRIPT_NAME'] = ''
            env['PATH_INFO'] = req.uri
        
        env['wsgi.input'] = InputWrapper(req)
        env['wsgi.errors'] = ErrorWrapper(req)
        env['wsgi.version'] = (1, 0)
        env['wsgi.run_once'] = False
        if env.get("HTTPS") in ('yes', 'on', '1'):
            env['wsgi.url_scheme'] = 'https'
        else:
            env['wsgi.url_scheme'] = 'http'
        env['wsgi.multithread']  = threaded
        env['wsgi.multiprocess'] = forked
        
        self.request = req 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:51,代碼來源:modpython.py


注:本文中的mod_python.apache.AP_MPMQ_IS_THREADED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。