def save(self): global _appconfig try: utils.makedirs(const.ConfigDir) serializer.save(const.ConfigFile, _appconfig) log.debug("Saved configuration") # Ensure it is secured. utils.secure_file(const.ConfigFile) except Exception as e: log.error("Unable to save configuration: " + str(e)) raise e
def load(cls, path): log.debug("Config loading class", cls.__name__) if not os.path.isfile(path): raise IOError("File not found") obj = serializer.load(path) # Secure the path. utils.secure_file(const.ConfigFile) # If we get to here, we have loaded the config. # Now check for version upgrade import appconfig appconfig.check_version(obj) return obj