equal
deleted
inserted
replaced
41 def source_cnx(source, dbname=None, special_privs=False, verbose=True): |
41 def source_cnx(source, dbname=None, special_privs=False, verbose=True): |
42 """open and return a connection to the system database defined in the |
42 """open and return a connection to the system database defined in the |
43 given server.serverconfig |
43 given server.serverconfig |
44 """ |
44 """ |
45 from getpass import getpass |
45 from getpass import getpass |
46 from logilab.common.db import get_connection |
46 from logilab.database import get_connection |
47 dbhost = source.get('db-host') |
47 dbhost = source.get('db-host') |
48 if dbname is None: |
48 if dbname is None: |
49 dbname = source['db-name'] |
49 dbname = source['db-name'] |
50 driver = source['db-driver'] |
50 driver = source['db-driver'] |
51 print '-> connecting to %s database' % driver, |
51 print '-> connecting to %s database' % driver, |
391 ) |
391 ) |
392 |
392 |
393 def run(self, args): |
393 def run(self, args): |
394 print '\n'+underline_title('Initializing the system database') |
394 print '\n'+underline_title('Initializing the system database') |
395 from cubicweb.server import init_repository |
395 from cubicweb.server import init_repository |
396 from logilab.common.db import get_connection |
396 from logilab.database import get_connection |
397 appid = pop_arg(args, msg='No instance specified !') |
397 appid = pop_arg(args, msg='No instance specified !') |
398 config = ServerConfiguration.config_for(appid) |
398 config = ServerConfiguration.config_for(appid) |
399 try: |
399 try: |
400 system = config.sources()['system'] |
400 system = config.sources()['system'] |
401 extra_args=system.get('db-extra-arguments') |
401 extra_args=system.get('db-extra-arguments') |