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
评论列表
文章目录