[shell] make process_script available throuhg c-c shell / migration script context stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 19 Oct 2009 09:15:19 +0200
branchstable
changeset 3715 e3ccadb126d7
parent 3710 5bfdb591050a
child 3716 2a86851cf2ff
[shell] make process_script available throuhg c-c shell / migration script context
common/migration.py
cwctl.py
server/migractions.py
--- a/common/migration.py	Fri Oct 16 17:12:10 2009 +0200
+++ b/common/migration.py	Mon Oct 19 09:15:19 2009 +0200
@@ -146,7 +146,7 @@
         ctx['versions_map'] = vmap
         if self.config.accept_mode('Any') and 'cubicweb' in vmap:
             migrdir = self.config.migration_scripts_dir()
-            self.process_script(join(migrdir, 'bootstrapmigration_repository.py'))
+            self.cmd_process_script(join(migrdir, 'bootstrapmigration_repository.py'))
         for cube, fromversion, toversion in toupgrade:
             if cube == 'cubicweb':
                 migrdir = self.config.migration_scripts_dir()
@@ -161,7 +161,7 @@
                     if prevversion is not None and version != prevversion:
                         self.cube_upgraded(cube, prevversion)
                     prevversion = version
-                    self.process_script(script)
+                    self.cmd_process_script(script)
                 self.cube_upgraded(cube, toversion)
             else:
                 self.cube_upgraded(cube, toversion)
@@ -263,7 +263,7 @@
                     context[attr[4:]] = getattr(self, attr)
         return context
 
-    def process_script(self, migrscript, funcname=None, *args, **kwargs):
+    def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs):
         """execute a migration script
         in interactive mode,  display the migration script path, ask for
         confirmation and execute it if confirmed
--- a/cwctl.py	Fri Oct 16 17:12:10 2009 +0200
+++ b/cwctl.py	Mon Oct 19 09:15:19 2009 +0200
@@ -777,7 +777,7 @@
         try:
             if args:
                 for arg in args:
-                    mih.process_script(arg)
+                    mih.cmd_process_script(arg)
             else:
                 mih.interactive_shell()
         finally:
--- a/server/migractions.py	Fri Oct 16 17:12:10 2009 +0200
+++ b/server/migractions.py	Mon Oct 19 09:15:19 2009 +0200
@@ -95,7 +95,7 @@
                 self.backup_database(askconfirm=False)
         super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options)
 
-    def process_script(self, migrscript, funcname=None, *args, **kwargs):
+    def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs):
         """execute a migration script
         in interactive mode,  display the migration script path, ask for
         confirmation and execute it if confirmed
@@ -105,7 +105,7 @@
                 if self.execscript_confirm(migrscript):
                     sqlexec(open(migrscript).read(), self.session.system_sql)
             else:
-                return super(ServerMigrationHelper, self).process_script(
+                return super(ServerMigrationHelper, self).cmd_process_script(
                     migrscript, funcname, *args, **kwargs)
             self.commit()
         except:
@@ -294,7 +294,7 @@
             self.confirm = yes
             self.execscript_confirm = yes
             try:
-                return self.process_script(apc, funcname, *args, **kwargs)
+                return self.cmd_process_script(apc, funcname, *args, **kwargs)
             finally:
                 self.confirm = confirm
                 self.execscript_confirm = execscript_confirm