Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Updated item_passed signal to send passed item in 'item' argument, instead of 'output' argument, keeping backwards compatibility for the 'output' argument. Closes #273

Pablo Hoffman002abf204f29
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)