server/serverctl.py
changeset 7061 bb2080547722
parent 7040 9b1f9bc74f5d
parent 7056 51f88f13d6f3
child 7112 bb27cc300040
equal deleted inserted replaced
7059:1d65b235549f 7061:bb2080547722
   128         pass
   128         pass
   129     return cnx
   129     return cnx
   130 
   130 
   131 def repo_cnx(config):
   131 def repo_cnx(config):
   132     """return a in-memory repository and a db api connection it"""
   132     """return a in-memory repository and a db api connection it"""
   133     from cubicweb.dbapi import in_memory_cnx
   133     from cubicweb.dbapi import in_memory_repo_cnx
   134     from cubicweb.server.utils import manager_userpasswd
   134     from cubicweb.server.utils import manager_userpasswd
   135     try:
   135     try:
   136         login = config.sources()['admin']['login']
   136         login = config.sources()['admin']['login']
   137         pwd = config.sources()['admin']['password']
   137         pwd = config.sources()['admin']['password']
   138     except KeyError:
   138     except KeyError:
   139         login, pwd = manager_userpasswd()
   139         login, pwd = manager_userpasswd()
   140     while True:
   140     while True:
   141         try:
   141         try:
   142             return in_memory_cnx(config, login, password=pwd)
   142             return in_memory_repo_cnx(config, login, password=pwd)
   143         except AuthenticationError:
   143         except AuthenticationError:
   144             print '-> Error: wrong user/password.'
   144             print '-> Error: wrong user/password.'
   145             # reset cubes else we'll have an assertion error on next retry
   145             # reset cubes else we'll have an assertion error on next retry
   146             config._cubes = None
   146             config._cubes = None
   147         login, pwd = manager_userpasswd()
   147         login, pwd = manager_userpasswd()