common/migration.py
changeset 2448 16261e66e421
parent 2446 440cb4ea7e5c
child 2460 ce1a7ffc6c90
equal deleted inserted replaced
2437:b6b98198ca52 2448:16261e66e421
     9 __docformat__ = "restructuredtext en"
     9 __docformat__ = "restructuredtext en"
    10 
    10 
    11 import sys
    11 import sys
    12 import os
    12 import os
    13 import logging
    13 import logging
    14 from tempfile import mktemp
    14 import tempfile
    15 from os.path import exists, join, basename, splitext
    15 from os.path import exists, join, basename, splitext
    16 
    16 
    17 from logilab.common.decorators import cached
    17 from logilab.common.decorators import cached
    18 from logilab.common.configuration import REQUIRED, read_old_config
    18 from logilab.common.configuration import REQUIRED, read_old_config
    19 
    19 
   335         # import locally, show_diffs unavailable in gae environment
   335         # import locally, show_diffs unavailable in gae environment
   336         from cubicweb.toolsutils import show_diffs
   336         from cubicweb.toolsutils import show_diffs
   337         configfile = self.config.main_config_file()
   337         configfile = self.config.main_config_file()
   338         if self._option_changes:
   338         if self._option_changes:
   339             read_old_config(self.config, self._option_changes, configfile)
   339             read_old_config(self.config, self._option_changes, configfile)
   340         newconfig = mktemp()
   340         newconfig = mkstemp()
   341         for optdescr in self._option_changes:
   341         for optdescr in self._option_changes:
   342             if optdescr[0] == 'added':
   342             if optdescr[0] == 'added':
   343                 optdict = self.config.get_option_def(optdescr[1])
   343                 optdict = self.config.get_option_def(optdescr[1])
   344                 if optdict.get('default') is REQUIRED:
   344                 if optdict.get('default') is REQUIRED:
   345                     self.config.input_option(optdescr[1], optdict)
   345                     self.config.input_option(optdescr[1], optdict)