From 002abf204f297b493f3fe01335c136bead5bbf02 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Mon, 13 Dec 2010 14:05:47 -0200 Subject: [PATCH] Updated item_passed signal to send passed item in 'item' argument, instead of 'output' argument, keeping backwards compatibility for the 'output' argument. Closes #273 --- docs/topics/signals.rst | 10 ++++++---- scrapy/core/scraper.py | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/topics/signals.rst b/docs/topics/signals.rst index f70afb910..d3875826b 100644 --- a/docs/topics/signals.rst +++ b/docs/topics/signals.rst @@ -83,10 +83,11 @@ item_passed ----------- .. signal:: item_passed -.. function:: item_passed(item, spider, output) +.. function:: item_passed(item, spider, original_item) - Sent after an item has passed all the :ref:`topics-item-pipeline` stages without - being dropped. + Sent after an item has passed all the :ref:`topics-item-pipeline` stages + without being dropped. Same as :func:`item_scraped` if there are no + pipelines enabled. This signal supports returning deferreds from their handlers. @@ -96,9 +97,10 @@ item_passed :param spider: the spider which scraped the item :type spider: :class:`~scrapy.spider.BaseSpider` object - :param output: the output of the item pipeline. This is typically the + :param original_item: the input of the item pipeline. This is typically the same :class:`~scrapy.item.Item` object received in the ``item`` parameter, unless some pipeline stage created a new item. + :type spider: :class:`~scrapy.spider.BaseSpider` object item_dropped ------------ diff --git a/scrapy/core/scraper.py b/scrapy/core/scraper.py index 832a2090b..7e2dd9822 100644 --- a/scrapy/core/scraper.py +++ b/scrapy/core/scraper.py @@ -209,6 +209,7 @@ class Scraper(object): log.err(output, 'Error processing %s' % item, spider=spider) else: log.msg(log.formatter.passed(output, spider), log.INFO, spider=spider) + # TODO: remove item_passed 'output' parameter for Scrapy 0.12 return send_catch_log_deferred(signal=signals.item_passed, \ - item=item, spider=spider, output=output) + item=output, spider=spider, output=output, original_item=item)