cubicweb/server/migractions.py
changeset 11699 b48020a80dc3
parent 11413 c172fa18565e
child 11767 432f87a63057
equal deleted inserted replaced
11698:9ea50837bc58 11699:b48020a80dc3
   136         except KeyError:
   136         except KeyError:
   137             login, pwd = manager_userpasswd()
   137             login, pwd = manager_userpasswd()
   138         while True:
   138         while True:
   139             try:
   139             try:
   140                 self.cnx = repoapi.connect(self.repo, login, password=pwd)
   140                 self.cnx = repoapi.connect(self.repo, login, password=pwd)
   141                 if not 'managers' in self.cnx.user.groups:
   141                 with self.cnx:  # needed to retrieve user's groups
   142                     print('migration need an account in the managers group')
   142                     if 'managers' not in self.cnx.user.groups:
   143                 else:
   143                         print('migration need an account in the managers group')
   144                     break
   144                     else:
       
   145                         break
       
   146                 self.cnx._open = None  # XXX needed to reuse it later
   145             except AuthenticationError:
   147             except AuthenticationError:
   146                 print('wrong user/password')
   148                 print('wrong user/password')
   147             except (KeyboardInterrupt, EOFError):
   149             except (KeyboardInterrupt, EOFError):
   148                 print('aborting...')
   150                 print('aborting...')
   149                 sys.exit(0)
   151                 sys.exit(0)