common/migration.py
branchstable
changeset 2124 5a0b02f37b23
parent 2122 4ea13a828513
child 2275 bc0bed0616a3
--- a/common/migration.py	Fri Jun 19 08:29:22 2009 +0200
+++ b/common/migration.py	Fri Jun 19 08:47:05 2009 +0200
@@ -17,6 +17,8 @@
 from logilab.common.decorators import cached
 from logilab.common.configuration import REQUIRED, read_old_config
 
+from cubicweb import ConfigurationError
+
 
 def migration_files(config, toupgrade):
     """return an orderer list of path of scripts to execute to upgrade
@@ -328,7 +330,7 @@
             self.config.add_cubes(newcubes)
         return newcubes
 
-    def cmd_remove_cube(self, cube, removedeps=True):
+    def cmd_remove_cube(self, cube, removedeps=False):
         if removedeps:
             toremove = self.config.expand_cubes([cube])
         else:
@@ -337,8 +339,9 @@
         basecubes = [c for c in origcubes if not c in toremove]
         self.config._cubes = tuple(self.config.expand_cubes(basecubes))
         removed = [p for p in origcubes if not p in self.config._cubes]
-        assert cube in removed, \
-               "can't remove cube %s, used as a dependancy" % cube
+        if not cube in removed:
+            raise ConfigurationError("can't remove cube %s, "
+                                     "used as a dependency" % cube)
         return removed
 
     def rewrite_configuration(self):