pgtoolkit/toolbase.py
changeset 31 c2e6e24b83d9
parent 30 a8b7cd92f39f
child 34 98c7809af415
--- a/pgtoolkit/toolbase.py	Mon Feb 27 15:12:40 2012 +0100
+++ b/pgtoolkit/toolbase.py	Mon Mar 05 18:36:46 2012 +0100
@@ -24,11 +24,10 @@
         self.pgm = pgmanager.get_instance()
         self.target_isolation_level = None
         
-    def init(self, *args):
+    def init(self):
         self.config.load('pgtoolkit.conf')
         self.args = self.parser.parse_args()
         self.init_logging()
-        self.prepare_conns(*args)
     
     def init_logging(self):
         # logging
@@ -75,7 +74,7 @@
                     dsn=dsn)
                 return True
 
-    def prepare_conns(self, *pgm_names):
+    def prepare_conns_from_cmdline_args(self, *pgm_names):
         if self.config.meta_db:
             self.pgm.create_conn(name='meta', dsn=self.config.meta_db)
         
@@ -97,7 +96,8 @@
         self.parser.add_argument('target', metavar='target', type=str, help='Target database')
       
     def init(self):
-        ToolBase.init(self, 'target')
+        ToolBase.init(self)
+        self.prepare_conns_from_cmdline_args('target')
 
 
 class SrcDstTool(ToolBase):
@@ -107,5 +107,6 @@
         self.parser.add_argument('dst', metavar='destination', type=str, help='Destination database')
       
     def init(self):
-        ToolBase.init(self, 'src', 'dst')
+        ToolBase.init(self)
+        self.prepare_conns_from_cmdline_args('src', 'dst')