def vhosts(self): content = WHITESPACE.sub(" ", self.__config) content = NL.sub("", content) vhosts = VHOST.findall(content) if len(vhosts) > 0: for vhost in vhosts: this_vhost = {} vhost_bits = vhost.split(";") for bit in vhost_bits: if bit.startswith("server_name"): server_name = bit.split()[1] if CONFIG.match(bit+";"): m = CONFIG.search(bit+";") this_vhost[m.group("name").upper()] = m.group("value") self.__vhosts[server_name] = this_vhost
def load_settings(self): """Start loading and setting config values""" for line in self.__config.split("\n"): line = line.strip() if not line or line[0] in ("\n", "#"): continue c = CONFIG.search(line) if c: name = c.group("name").upper() value = c.group("value") if not value: value = None self.set(name, value)