migration.py
changeset 8056 8909800a8c51
parent 7879 9aae456abab5
child 8119 29cdde6bb9ef
equal deleted inserted replaced
8055:368d8902e597 8056:8909800a8c51
    32 from logilab.common.shellutils import ASK
    32 from logilab.common.shellutils import ASK
    33 from logilab.common.changelog import Version
    33 from logilab.common.changelog import Version
    34 
    34 
    35 from cubicweb import ConfigurationError, ExecutionError
    35 from cubicweb import ConfigurationError, ExecutionError
    36 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
    36 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
       
    37 from cubicweb.toolsutils import show_diffs
    37 
    38 
    38 def filter_scripts(config, directory, fromversion, toversion, quiet=True):
    39 def filter_scripts(config, directory, fromversion, toversion, quiet=True):
    39     """return a list of paths of migration files to consider to upgrade
    40     """return a list of paths of migration files to consider to upgrade
    40     from a version to a greater one
    41     from a version to a greater one
    41     """
    42     """
   415             raise ConfigurationError("can't remove cube %s, "
   416             raise ConfigurationError("can't remove cube %s, "
   416                                      "used as a dependency" % cube)
   417                                      "used as a dependency" % cube)
   417         return removed
   418         return removed
   418 
   419 
   419     def rewrite_configuration(self):
   420     def rewrite_configuration(self):
   420         # import locally, show_diffs unavailable in gae environment
       
   421         from cubicweb.toolsutils import show_diffs
       
   422         configfile = self.config.main_config_file()
   421         configfile = self.config.main_config_file()
   423         if self._option_changes:
   422         if self._option_changes:
   424             read_old_config(self.config, self._option_changes, configfile)
   423             read_old_config(self.config, self._option_changes, configfile)
   425         fd, newconfig = tempfile.mkstemp()
   424         fd, newconfig = tempfile.mkstemp()
   426         for optdescr in self._option_changes:
   425         for optdescr in self._option_changes: