From b9d3a2cb96221d3c14c15d1b18330a2778d88e7f Mon Sep 17 00:00:00 2001 From: elpolilla Date: Mon, 26 Jan 2009 12:15:31 +0000 Subject: [PATCH] Improved adaptors debugging in order to make it clearer for reading --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40768 --- scrapy/trunk/scrapy/item/adaptors.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scrapy/trunk/scrapy/item/adaptors.py b/scrapy/trunk/scrapy/item/adaptors.py index 85efee190..1a037df6f 100644 --- a/scrapy/trunk/scrapy/item/adaptors.py +++ b/scrapy/trunk/scrapy/item/adaptors.py @@ -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)