Example #1
0
class Conf(object):
    def __init__(self, file):
        self.__ini = DictIni(file)

        # to recreate the new INI file, bases on dict4ini
        if "jBrout" not in self.__ini:
            # clear old values, to restart a new one
            self.__ini.clear()

    def __getitem__(self, n):
        """ main conf get """
        return self.__ini.jBrout[n]

    def __contains__(self, n):
        """ main conf test """
        return n in self.__ini.jBrout

    def __setitem__(self, n, v):
        """ main conf set """
        self.__ini.jBrout[n] = v

    def getSubConf(self, n):
        """ sub conf get """
        return self.__ini[n]

    def save(self):
        self.__ini.save()
Example #2
0
    def __init__(self, file):
        self.__ini = DictIni(file)

        # to recreate the new INI file, bases on dict4ini
        if "jBrout" not in self.__ini:
            # clear old values, to restart a new one
            self.__ini.clear()