cubicweb/server/migractions.py
changeset 12039 7514626e1dc5
parent 12021 cc8135ecfbb8
child 12508 a8c1ea390400
equal deleted inserted replaced
12038:3c60180481ac 12039:7514626e1dc5
    94             assert repo
    94             assert repo
    95         if cnx is not None:
    95         if cnx is not None:
    96             assert repo
    96             assert repo
    97             self.cnx = cnx
    97             self.cnx = cnx
    98             self.repo = repo
    98             self.repo = repo
    99             self.session = cnx.session
       
   100         elif connect:
    99         elif connect:
   101             self.repo = config.repository()
   100             self.repo = config.repository()
   102             self.set_cnx()
   101             self.set_cnx()
   103         else:
       
   104             self.session = None
       
   105         # no config on shell to a remote instance
   102         # no config on shell to a remote instance
   106         if config is not None and (cnx or connect):
   103         if config is not None and (cnx or connect):
   107             repo = self.repo
   104             repo = self.repo
   108             # register a hook to clear our group_mapping cache and the
   105             # register a hook to clear our group_mapping cache and the
   109             # self._synchronized set when some group is added or updated
   106             # self._synchronized set when some group is added or updated
   152             try:
   149             try:
   153                 login, pwd = manager_userpasswd()
   150                 login, pwd = manager_userpasswd()
   154             except (KeyboardInterrupt, EOFError):
   151             except (KeyboardInterrupt, EOFError):
   155                 print('aborting...')
   152                 print('aborting...')
   156                 sys.exit(0)
   153                 sys.exit(0)
   157         self.session = self.cnx.session
       
   158 
   154 
   159     def cube_upgraded(self, cube, version):
   155     def cube_upgraded(self, cube, version):
   160         self.cmd_set_property('system.version.%s' % cube.lower(),
   156         self.cmd_set_property('system.version.%s' % cube.lower(),
   161                               text_type(version))
   157                               text_type(version))
   162         self.commit()
   158         self.commit()