PCGIServer.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ZServer 作者: zopefoundation 项目源码 文件源码
def read_info(self, info_file):
        "read configuration information from a PCGI info file"
        lines = open(info_file).readlines()
        directives = {}
        try:
            for line in lines:
                line = string.strip(line)
                if not len(line) or line[0] == '#':
                    continue
                k, v = string.split(line, '=', 1)
                directives[string.strip(k)] = string.strip(v)
        except Exception:
            raise ParseError('Error parsing PCGI info file')

        self.pid_file = directives.get('PCGI_PID_FILE', None)
        self.socket_file = directives.get('PCGI_SOCKET_FILE', None)
        if 'PCGI_PORT' in directives:
            self.port = string.atoi(directives['PCGI_PORT'])
        if 'PCGI_MODULE' in directives:
            self.module = directives['PCGI_MODULE']
        elif 'PCGI_MODULE_PATH' in directives:
            path = directives['PCGI_MODULE_PATH']
            path, module = os.path.split(path)
            module, ext = os.path.splitext(module)
            self.module = module
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号