cwctl.py
branchstable
changeset 3707 78596919ede3
parent 3700 fd550e4dc515
child 3709 e67ade20bf80
--- a/cwctl.py	Fri Oct 16 15:43:23 2009 +0200
+++ b/cwctl.py	Fri Oct 16 16:29:46 2009 +0200
@@ -741,12 +741,23 @@
     def run(self, args):
         appid = pop_arg(args, 99, msg="No instance specified !")
         if self.config.pyro:
+            from cubicweb import AuthenticationError
             from cubicweb.dbapi import connect
             from cubicweb.server.utils import manager_userpasswd
             from cubicweb.server.migractions import ServerMigrationHelper
-            login, pwd = manager_userpasswd(msg=None)
-            cnx = connect(appid, login=login, password=pwd,
-                          host=self.config.pyro_ns_host, mulcnx=False)
+            while True:
+                try:
+                    login, pwd = manager_userpasswd(msg=None)
+                    cnx = connect(appid, login=login, password=pwd,
+                                  host=self.config.pyro_ns_host, mulcnx=False)
+                except AuthenticationError, ex:
+                    print ex
+                except (KeyboardInterrupt, EOFError):
+                    print
+                    sys.exit(0)
+                else:
+                    break
+            cnx.load_appobjects()
             repo = cnx._repo
             mih = ServerMigrationHelper(None, repo=repo, cnx=cnx,
                                          # hack so it don't try to load fs schema