cubicweb/server/migractions.py
changeset 11980 7c8aadc4b483
parent 11976 978a5773c4c3
child 11981 56e99b59272f
equal deleted inserted replaced
11979:c93b47ba0093 11980:7c8aadc4b483
   266         if osp.isfile(osp.join(tmpdir, 'format.txt')):
   266         if osp.isfile(osp.join(tmpdir, 'format.txt')):
   267             with open(osp.join(tmpdir, 'format.txt')) as format_file:
   267             with open(osp.join(tmpdir, 'format.txt')) as format_file:
   268                 written_format = format_file.readline().strip()
   268                 written_format = format_file.readline().strip()
   269                 if written_format in ('portable', 'native'):
   269                 if written_format in ('portable', 'native'):
   270                     format = written_format
   270                     format = written_format
   271         self.config.init_cnxset_pool = False
   271         repo = self.repo = repository.Repository(self.config, bootstrap=False)
   272         repo = self.repo = repository.Repository(self.config)
       
   273         source = repo.system_source
   272         source = repo.system_source
   274         try:
   273         try:
   275             source.restore(osp.join(tmpdir, source.uri), self.confirm, drop, format)
   274             source.restore(osp.join(tmpdir, source.uri), self.confirm, drop, format)
   276         except Exception as exc:
   275         except Exception as exc:
   277             print('-> error trying to restore %s [%s]' % (source.uri, exc))
   276             print('-> error trying to restore %s [%s]' % (source.uri, exc))