def __init__(self, *args, **kwargs): self.fpath = os.path.expanduser(self.strip_kwarg(kwargs, 'fpath')) self.section = self.strip_kwarg(kwargs, 'section') initvals = self.strip_kwarg(kwargs, 'initvals') self.header = self.strip_kwarg(kwargs, 'header') SafeConfigParser.__init__(self, *args, **kwargs) self.add_section(self.section) for option in initvals: self.set(self.section, option, initvals[option]) self.read(self.fpath) self.save()
def __init__(self, filePath=None, caDir=None): """Initial OpenSSL configuration optionally setting a file path to read from @type filePath: string @param filePath: path to OpenSSL configuration file @type caDir: string @param caDir: directory for SimpleCA. This is substituted for $dir in OpenSSL config file where present. caDir can be left out in which case the substitution is not done""" SafeConfigParser.__init__(self) self._reqDN = None self._setFilePath(filePath) # Set-up CA directory self.setCADir(caDir)
def __init__(self, filenames=None): """Initialization reads settings from config files and env. variables. Parameters ---------- filenames : list of filenames """ SafeConfigParser.__init__(self) # store additional config file names if not filenames is None: self.__cfg_filenames = filenames else: self.__cfg_filenames = [] # set critical defaults for sec, vars in iteritems(ConfigManager._DEFAULTS): self.add_section(sec) for key, value in iteritems(vars): self.set(sec, key, value) # now get the setting self.reload()
def __init__(self, filename): SafeConfigParser.__init__(self) self.filename = filename self.read(self.filename)