[Erp5-report] r43094 nicolas.dumazet - /erp5/trunk/products/ERP5Type/tests/Sequence.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Feb 5 06:42:48 CET 2011


Author: nicolas.dumazet
Date: Sat Feb  5 06:42:48 2011
New Revision: 43094

URL: http://svn.erp5.org?rev=43094&view=rev
Log:
Sequence.asText() so I can easily see where I am when debugging a Sequence test.

Modified:
    erp5/trunk/products/ERP5Type/tests/Sequence.py

Modified: erp5/trunk/products/ERP5Type/tests/Sequence.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/Sequence.py?rev=43094&r1=43093&r2=43094&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/Sequence.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/Sequence.py [utf8] Sat Feb  5 06:42:48 2011
@@ -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:



More information about the Erp5-report mailing list