server/sources/native.py
changeset 3890 d7a270f50f54
parent 3720 5376aaadd16b
parent 3835 a191b3b9e455
child 3998 94cc7cad3d2d
equal deleted inserted replaced
3810:5b75fd66c80e 3890:d7a270f50f54
    16 from threading import Lock
    16 from threading import Lock
    17 from datetime import datetime
    17 from datetime import datetime
    18 from base64 import b64decode, b64encode
    18 from base64 import b64decode, b64encode
    19 
    19 
    20 from logilab.common.cache import Cache
    20 from logilab.common.cache import Cache
    21 from logilab.common.configuration import REQUIRED
    21 from logilab.common.configuration import Method
    22 from logilab.common.adbh import get_adv_func_helper
    22 from logilab.common.adbh import get_adv_func_helper
       
    23 from logilab.common.shellutils import getlogin
    23 
    24 
    24 from indexer import get_indexer
    25 from indexer import get_indexer
    25 
    26 
    26 from cubicweb import UnknownEid, AuthenticationError, Binary, server
    27 from cubicweb import UnknownEid, AuthenticationError, Binary, server
       
    28 from cubicweb.cwconfig import CubicWebNoAppConfiguration
    27 from cubicweb.server.utils import crypt_password
    29 from cubicweb.server.utils import crypt_password
    28 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn
    30 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn
    29 from cubicweb.server.rqlannotation import set_qdata
    31 from cubicweb.server.rqlannotation import set_qdata
    30 from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results
    32 from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results
    31 from cubicweb.server.sources.rql2sql import SQLGenerator
    33 from cubicweb.server.sources.rql2sql import SQLGenerator
   113           'help': 'database port',
   115           'help': 'database port',
   114           'group': 'native-source', 'inputlevel': 1,
   116           'group': 'native-source', 'inputlevel': 1,
   115           }),
   117           }),
   116         ('db-name',
   118         ('db-name',
   117          {'type' : 'string',
   119          {'type' : 'string',
   118           'default': REQUIRED,
   120           'default': Method('default_instance_id'),
   119           'help': 'database name',
   121           'help': 'database name',
   120           'group': 'native-source', 'inputlevel': 0,
   122           'group': 'native-source', 'inputlevel': 0,
   121           }),
   123           }),
   122         ('db-user',
   124         ('db-user',
   123          {'type' : 'string',
   125          {'type' : 'string',
   124           'default': 'cubicweb',
   126           'default': CubicWebNoAppConfiguration.mode == 'user' and getlogin() or 'cubicweb',
   125           'help': 'database user',
   127           'help': 'database user',
   126           'group': 'native-source', 'inputlevel': 0,
   128           'group': 'native-source', 'inputlevel': 0,
   127           }),
   129           }),
   128         ('db-password',
   130         ('db-password',
   129          {'type' : 'password',
   131          {'type' : 'password',