server/migractions.py
changeset 8673 8ea63a2cc2cc
parent 8669 62213a34726e
child 8694 d901c36bcfce
equal deleted inserted replaced
8672:e8afecc3b576 8673:8ea63a2cc2cc
    54 from cubicweb.predicates import is_instance
    54 from cubicweb.predicates import is_instance
    55 from cubicweb.schema import (ETYPE_NAME_MAP, META_RTYPES, VIRTUAL_RTYPES,
    55 from cubicweb.schema import (ETYPE_NAME_MAP, META_RTYPES, VIRTUAL_RTYPES,
    56                              PURE_VIRTUAL_RTYPES,
    56                              PURE_VIRTUAL_RTYPES,
    57                              CubicWebRelationSchema, order_eschemas)
    57                              CubicWebRelationSchema, order_eschemas)
    58 from cubicweb.cwvreg import CW_EVENT_MANAGER
    58 from cubicweb.cwvreg import CW_EVENT_MANAGER
    59 from cubicweb.dbapi import get_repository, repo_connect
    59 from cubicweb.dbapi import get_repository, _repo_connect
    60 from cubicweb.migration import MigrationHelper, yes
    60 from cubicweb.migration import MigrationHelper, yes
    61 from cubicweb.server import hook
    61 from cubicweb.server import hook
    62 try:
    62 try:
    63     from cubicweb.server import SOURCE_TYPES, schemaserial as ss
    63     from cubicweb.server import SOURCE_TYPES, schemaserial as ss
    64     from cubicweb.server.utils import manager_userpasswd
    64     from cubicweb.server.utils import manager_userpasswd
   277                 pwd = sourcescfg['admin']['password']
   277                 pwd = sourcescfg['admin']['password']
   278             except KeyError:
   278             except KeyError:
   279                 login, pwd = manager_userpasswd()
   279                 login, pwd = manager_userpasswd()
   280             while True:
   280             while True:
   281                 try:
   281                 try:
   282                     self._cnx = repo_connect(self.repo, login, password=pwd)
   282                     self._cnx = _repo_connect(self.repo, login, password=pwd)
   283                     if not 'managers' in self._cnx.user(self.session).groups:
   283                     if not 'managers' in self._cnx.user(self.session).groups:
   284                         print 'migration need an account in the managers group'
   284                         print 'migration need an account in the managers group'
   285                     else:
   285                     else:
   286                         break
   286                         break
   287                 except AuthenticationError:
   287                 except AuthenticationError: