cubicweb/server/migractions.py
changeset 11699 b48020a80dc3
parent 11413 c172fa18565e
child 11767 432f87a63057
--- a/cubicweb/server/migractions.py	Wed Oct 05 10:17:39 2016 +0200
+++ b/cubicweb/server/migractions.py	Mon Jun 06 15:26:49 2016 +0200
@@ -138,10 +138,12 @@
         while True:
             try:
                 self.cnx = repoapi.connect(self.repo, login, password=pwd)
-                if not 'managers' in self.cnx.user.groups:
-                    print('migration need an account in the managers group')
-                else:
-                    break
+                with self.cnx:  # needed to retrieve user's groups
+                    if 'managers' not in self.cnx.user.groups:
+                        print('migration need an account in the managers group')
+                    else:
+                        break
+                self.cnx._open = None  # XXX needed to reuse it later
             except AuthenticationError:
                 print('wrong user/password')
             except (KeyboardInterrupt, EOFError):