339 # import locally, show_diffs unavailable in gae environment |
339 # import locally, show_diffs unavailable in gae environment |
340 from cubicweb.toolsutils import show_diffs |
340 from cubicweb.toolsutils import show_diffs |
341 configfile = self.config.main_config_file() |
341 configfile = self.config.main_config_file() |
342 if self._option_changes: |
342 if self._option_changes: |
343 read_old_config(self.config, self._option_changes, configfile) |
343 read_old_config(self.config, self._option_changes, configfile) |
344 _, newconfig = tempfile.mkstemp() |
344 fd, newconfig = tempfile.mkstemp() |
345 for optdescr in self._option_changes: |
345 for optdescr in self._option_changes: |
346 if optdescr[0] == 'added': |
346 if optdescr[0] == 'added': |
347 optdict = self.config.get_option_def(optdescr[1]) |
347 optdict = self.config.get_option_def(optdescr[1]) |
348 if optdict.get('default') is REQUIRED: |
348 if optdict.get('default') is REQUIRED: |
349 self.config.input_option(optdescr[1], optdict) |
349 self.config.input_option(optdescr[1], optdict) |
350 self.config.generate_config(open(newconfig, 'w')) |
350 self.config.generate_config(open(newconfig, 'w')) |
351 show_diffs(configfile, newconfig) |
351 show_diffs(configfile, newconfig) |
|
352 os.close(fd) |
352 if exists(newconfig): |
353 if exists(newconfig): |
353 os.unlink(newconfig) |
354 os.unlink(newconfig) |
354 |
355 |
355 |
356 |
356 from logging import getLogger |
357 from logging import getLogger |