From eff09f2f7808a6887b60c8e9e383eb477d7b2ed6 Mon Sep 17 00:00:00 2001 From: elpolilla Date: Tue, 2 Dec 2008 02:17:15 +0000 Subject: [PATCH] Added some missing postprocessing to items in parse command --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40455 --- scrapy/trunk/scrapy/command/commands/parse_method.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scrapy/trunk/scrapy/command/commands/parse_method.py b/scrapy/trunk/scrapy/command/commands/parse_method.py index d4d10eac4..1f4b4585a 100644 --- a/scrapy/trunk/scrapy/command/commands/parse_method.py +++ b/scrapy/trunk/scrapy/command/commands/parse_method.py @@ -20,6 +20,10 @@ class Command(ScrapyCommand): parser.add_option("--nocolour", dest="nocolour", action="store_true", help="avoid using pygments to colorize the output") def pipeline_process(self, item, opts): + item.set_guid(spider) + for key in item.__dict__.keys(): + if key.startswith('_'): + item.__dict__.pop(key, None) return item def run_method(self, response, method, args, opts): @@ -39,10 +43,6 @@ class Command(ScrapyCommand): result = method_fcn(response) links = [i for i in result if isinstance(i, Request)] items = [self.pipeline_process(i, opts) for i in result if isinstance(i, ScrapedItem)] - for item in items: - for key in item.__dict__.keys(): - if key.startswith('_'): - item.__dict__.pop(key, None) return items, links