cubicweb/migration.py
changeset 12745 cc681b6fcffa
parent 12744 19aef4729d45
child 12752 3cf37ec616ad
equal deleted inserted replaced
12744:19aef4729d45 12745:cc681b6fcffa
   198             ask_confirm = True
   198             ask_confirm = True
   199         if not ask_confirm or self.confirm(msg):
   199         if not ask_confirm or self.confirm(msg):
   200             return meth(*args, **kwargs)
   200             return meth(*args, **kwargs)
   201 
   201 
   202     def confirm(self, question, # pylint: disable=E0202
   202     def confirm(self, question, # pylint: disable=E0202
   203                 shell=True, abort=True, retry=False, pdb=False, default='y'):
   203                 shell=True, abort=True, retry=False, pdb=False, default='y', traceback=None):
   204         """ask for confirmation and return true on positive answer
   204         """ask for confirmation and return true on positive answer
   205 
   205 
   206         if `retry` is true the r[etry] answer may return 2
   206         if `retry` is true the r[etry] answer may return 2
   207         """
   207         """
   208         possibleanswers = ['y', 'n']
   208         possibleanswers = ['y', 'n']
   224             return 2
   224             return 2
   225         if answer == 'abort':
   225         if answer == 'abort':
   226             raise SystemExit(1)
   226             raise SystemExit(1)
   227         if answer == 'shell':
   227         if answer == 'shell':
   228             self.interactive_shell()
   228             self.interactive_shell()
   229             return self.confirm(question, shell, abort, retry, pdb, default)
   229             return self.confirm(question, shell, abort, retry, pdb, default, traceback)
   230         if answer == 'pdb':
   230         if answer == 'pdb':
   231             pdb = utils.get_pdb()
   231             pdb = utils.get_pdb()
   232             pdb.set_trace()
   232             if traceback:
   233             return self.confirm(question, shell, abort, retry, pdb, default)
   233                 pdb.post_mortem(traceback)
       
   234             else:
       
   235                 pdb.set_trace()
       
   236             return self.confirm(question, shell, abort, retry, pdb, default, traceback)
   234         return True
   237         return True
   235 
   238 
   236     def interactive_shell(self):
   239     def interactive_shell(self):
   237         self.confirm = yes
   240         self.confirm = yes
   238         self.need_wrap = False
   241         self.need_wrap = False