Commit 1d70fa8f authored by Nicolas Dumazet's avatar Nicolas Dumazet

Sequence.asText() so I can easily see where I am when debugging a Sequence test.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43094 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 040d3cb6
......@@ -60,14 +60,8 @@ def special_extract_tb(tb, limit = None):
if co == Sequence.play.func_code:
if line is None:
line = ''
line += '\n Current Sequence:'
sequence = f.f_locals['self']
for idx, step in enumerate(sequence._step_list):
if idx == sequence._played_index:
line += '\n > %s' % step._method_name
else:
line += '\n %s' % step._method_name
line += '\n Current Sequence:\n%s' % sequence.asText()
list.append((filename, lineno, name, line))
tb = tb.tb_next
n = n+1
......@@ -105,6 +99,18 @@ class Sequence:
self._played_index = 0
self._context = context
def asText(self):
"""
Representation of the current Sequence. Useful for debuggers.
"""
line_list = []
for idx, step in enumerate(self._step_list):
if idx == self._played_index:
line_list.append(' > %s' % step._method_name)
else:
line_list.append(' %s' % step._method_name)
return '\n'.join(line_list)
def play(self, context, sequence=None, sequence_number=0, quiet=0):
if not quiet:
if self._played_index == 0:
......
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