--- 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):