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