Commit cf7e20d9 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

ReplApplication: add "debug" command prompting a python shell

parent 44c1a836
......@@ -65,7 +65,9 @@ class WeboobDebug(Application):
funcs = [self.bpython, self.ipython, self.python]
else:
funcs = [self.ipython, self.bpython, self.python]
self.launch(funcs, locs, banner)
def launch(self, funcs, locs, banner):
for func in funcs:
try:
func(locs, banner)
......
......@@ -1239,3 +1239,21 @@ class ReplApplication(ConsoleApplication, MyCmd):
def flush(self):
self.formatter.flush()
def do_debug(self, line):
"""
debug
Launch a debug Python shell
"""
from weboob.applications.weboobdebug import weboobdebug
app = weboobdebug.WeboobDebug()
locs = dict(application=self, weboob=self.weboob)
banner = ('Weboob debug shell\n\nAvailable variables:\n'
+ '\n'.join([' %s: %s' % (k, v) for k, v in locs.items()]))
funcs = [app.ipython, app.bpython, app.python]
app.launch(funcs, locs, banner)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment