def upgrade(self, default_config_file): '''Upgrade the configuration based on a new default config file. ''' pcp = PythonConfigParser() pcp.read(default_config_file) for section in pcp.sections(): self.setdefaults(section, dict(pcp.items(section))) self.write()
def update_config(self, filename, overwrite=False): '''Upgrade the configuration based on a new default config file. Overwrite any existing values if overwrite is True. ''' pcp = PythonConfigParser() pcp.read(filename) confset = self.setall if overwrite else self.setdefaults for section in pcp.sections(): confset(section, dict(pcp.items(section))) self.write()