server/sources/native.py
branchstable
changeset 3835 a191b3b9e455
parent 3689 deb13e88e037
child 3890 d7a270f50f54
child 3958 505025eb0d37
equal deleted inserted replaced
3833:5507aa75f601 3835:a191b3b9e455
    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
   118           'help': 'database port',
   120           'help': 'database port',
   119           'group': 'native-source', 'inputlevel': 1,
   121           'group': 'native-source', 'inputlevel': 1,
   120           }),
   122           }),
   121         ('db-name',
   123         ('db-name',
   122          {'type' : 'string',
   124          {'type' : 'string',
   123           'default': REQUIRED,
   125           'default': Method('default_instance_id'),
   124           'help': 'database name',
   126           'help': 'database name',
   125           'group': 'native-source', 'inputlevel': 0,
   127           'group': 'native-source', 'inputlevel': 0,
   126           }),
   128           }),
   127         ('db-user',
   129         ('db-user',
   128          {'type' : 'string',
   130          {'type' : 'string',
   129           'default': 'cubicweb',
   131           'default': CubicWebNoAppConfiguration.mode == 'user' and getlogin() or 'cubicweb',
   130           'help': 'database user',
   132           'help': 'database user',
   131           'group': 'native-source', 'inputlevel': 0,
   133           'group': 'native-source', 'inputlevel': 0,
   132           }),
   134           }),
   133         ('db-password',
   135         ('db-password',
   134          {'type' : 'password',
   136          {'type' : 'password',