Improved adaptors debugging in order to make it clearer for reading

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40768
This commit is contained in:
elpolilla 2009-01-26 12:15:31 +00:00
parent bc4e80f640
commit b9d3a2cb96
1 changed files with 6 additions and 2 deletions

View File

@ -60,13 +60,15 @@ class AdaptorPipe(list):
Execute the adaptor pipeline for this attribute.
"""
debug_padding = 0
values = [value]
for adaptor in self:
next_round = []
for val in values:
try:
if self.debug:
print " %07s | input >" % adaptor.name, repr(val)
print "%sinput | %s <" % (' ' * debug_padding, adaptor.name), repr(val)
val = adaptor(val, kwargs or {})
if isinstance(val, tuple):
@ -75,11 +77,13 @@ class AdaptorPipe(list):
next_round.append(val)
if self.debug:
print " %07s | output >" % adaptor.name, repr(val)
print "%soutput | %s >" % (' ' * debug_padding, adaptor.name), repr(val)
except Exception:
print "Error in '%s' adaptor. Traceback text:" % adaptor.name
print format_exc()
return
debug_padding += 2
values = next_round
return tuple(values)