mytoolkit/mymanager.py
changeset 16 cb7e13711a99
parent 15 93450b43e627
child 18 a9e12b7cc207
--- a/mytoolkit/mymanager.py	Mon Nov 14 18:00:53 2011 +0100
+++ b/mytoolkit/mymanager.py	Mon Nov 21 10:43:37 2011 +0100
@@ -93,6 +93,17 @@
         self.init_statement = init_statement
         self.keep_open = keep_open
         self.parameters = kw
+        self.adjust_parameters()
+    
+    def adjust_parameters(self):
+        '''Rename Postgres parameters to proper value for MySQL.'''
+        m = {'dbname' : 'db', 'password' : 'passwd'}
+        res = dict()
+        for k, v in list(self.parameters.items()):
+            if k in m:
+                k = m[k]
+            res[k] = v
+        self.parameters = res
 
 
 class RowDict(dict):
@@ -143,7 +154,7 @@
         for conn in tuple(self.conn_known.keys()):
             self.destroy_conn(conn)
 
-    def create_conn(self, name='default', isolation_level=None, dsn=None, **kw):
+    def create_conn(self, name='default', isolation_level=None, **kw):
         '''Create named connection.'''
         if name in self.conn_known:
             raise MyManagerError('Connection name "%s" already registered.' % name)