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

This commit is contained in:
Pablo Hoffman 2010-12-13 14:05:47 -02:00
parent f984d438a0
commit 002abf204f
2 changed files with 8 additions and 5 deletions

View File

@ -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
------------

View File

@ -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)