server/serverctl.py
branchstable
changeset 4837 54969eec48eb
parent 4719 aaed3f813ef8
child 4845 dc351b96f596
child 4888 fc8b4d861f34
--- a/server/serverctl.py	Tue Mar 09 10:48:46 2010 +0100
+++ b/server/serverctl.py	Tue Mar 09 10:49:57 2010 +0100
@@ -63,9 +63,18 @@
             password = getpass('password: ')
     extra_args = source.get('db-extra-arguments')
     extra = extra_args and {'extra_args': extra_args} or {}
-    return get_connection(driver, dbhost, dbname, user, password=password,
-                          port=source.get('db-port'),
-                          **extra)
+    cnx = get_connection(driver, dbhost, dbname, user, password=password,
+                         port=source.get('db-port'),
+                         **extra)
+    if not hasattr(cnx, 'logged_user'): # XXX logilab.db compat
+        try:
+            cnx.logged_user = user
+        except AttributeError:
+            # C object, __slots__
+            from logilab.db import _SimpleConnectionWrapper
+            cnx = _SimpleConnectionWrapper(cnx)
+            cnx.logged_user = user
+    return cnx
 
 def system_source_cnx(source, dbms_system_base=False,
                       special_privs='CREATE/DROP DATABASE', verbose=True):