1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-25 01:43:50 +00:00

remove response from item_passed and item_dropped signal api

This commit is contained in:
Daniel Grana 2009-07-09 16:57:03 -03:00
parent aba16c20c4
commit eff8ea6173
2 changed files with 6 additions and 12 deletions

View File

@ -115,7 +115,7 @@ order.
:type response: :class:`~scrapy.http.Response` object
.. signal:: item_passed
.. function:: item_passed(item, spider, response, output)
.. function:: item_passed(item, spider, output)
Sent after an item has passed all the :ref:`topics-item-pipeline` stages without
being dropped.
@ -126,15 +126,12 @@ order.
:param spider: the spider which scraped the item
:type spider: :class:`~scrapy.spider.BaseSpider` object
:param response: the response from which the item was scraped
:type response: :class:`~scrapy.http.Response` object
:param output: the output of the item pipeline. This is typically the
same :class:`~scrapy.item.ScrapedItem` object received in the ``item``
parameter, unless some pipeline stage created a new item.
.. signal:: item_dropped
.. function:: item_dropped(item, spider, response, exception)
.. function:: item_dropped(item, spider, exception)
Sent after an item has been dropped from the :ref:`topics-item-pipeline`
when some stage raised a :exception:`DropItem` exception.
@ -145,9 +142,6 @@ order.
:param spider: the spider which scraped the item
:type spider: :class:`~scrapy.spider.BaseSpider` object
:param response: the response from which the item was scraped
:type response: :class:`~scrapy.http.Response` object
:param exception: the exception (which must be a :exception:`DropItem`
subclass) which caused the item to be dropped
:type exception: :exception:`DropItem` exception

View File

@ -157,7 +157,7 @@ class Scraper(object):
item=output, spider=spider, response=response)
self.sites[domain].itemproc_size += 1
dfd = self.itemproc.process_item(output, spider)
dfd.addBoth(self._itemproc_finished, output, response, spider)
dfd.addBoth(self._itemproc_finished, output, spider)
return dfd
elif output is None:
pass
@ -179,7 +179,7 @@ class Scraper(object):
else:
return spider_failure # exceptions raised in the spider code
def _itemproc_finished(self, output, item, response, spider):
def _itemproc_finished(self, output, item, spider):
"""ItemProcessor finished for the given ``item`` and returned ``output``
"""
domain = spider.domain_name
@ -189,11 +189,11 @@ class Scraper(object):
if isinstance(ex, DropItem):
log.msg("Dropped %s - %s" % (item, str(ex)), log.DEBUG, domain=domain)
signals.send_catch_log(signal=signals.item_dropped, sender=self.__class__, \
item=item, spider=spider, response=response, exception=output.value)
item=item, spider=spider, exception=output.value)
else:
log.msg('Error processing %s - %s' % (item, output), \
log.ERROR, domain=domain)
else:
signals.send_catch_log(signal=signals.item_passed, sender=self.__class__, \
item=item, spider=spider, response=response, output=output)
item=item, spider=spider, output=output)