server/sources/native.py
changeset 3890 d7a270f50f54
parent 3720 5376aaadd16b
parent 3835 a191b3b9e455
child 3998 94cc7cad3d2d
--- a/server/sources/native.py	Sun Nov 08 21:53:18 2009 +0100
+++ b/server/sources/native.py	Fri Nov 20 19:35:54 2009 +0100
@@ -18,12 +18,14 @@
 from base64 import b64decode, b64encode
 
 from logilab.common.cache import Cache
-from logilab.common.configuration import REQUIRED
+from logilab.common.configuration import Method
 from logilab.common.adbh import get_adv_func_helper
+from logilab.common.shellutils import getlogin
 
 from indexer import get_indexer
 
 from cubicweb import UnknownEid, AuthenticationError, Binary, server
+from cubicweb.cwconfig import CubicWebNoAppConfiguration
 from cubicweb.server.utils import crypt_password
 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn
 from cubicweb.server.rqlannotation import set_qdata
@@ -115,13 +117,13 @@
           }),
         ('db-name',
          {'type' : 'string',
-          'default': REQUIRED,
+          'default': Method('default_instance_id'),
           'help': 'database name',
           'group': 'native-source', 'inputlevel': 0,
           }),
         ('db-user',
          {'type' : 'string',
-          'default': 'cubicweb',
+          'default': CubicWebNoAppConfiguration.mode == 'user' and getlogin() or 'cubicweb',
           'help': 'database user',
           'group': 'native-source', 'inputlevel': 0,
           }),