From eff8ea61730ec8c3f202fa8dfcf1fa16cb5345fa Mon Sep 17 00:00:00 2001 From: Daniel Grana Date: Thu, 9 Jul 2009 16:57:03 -0300 Subject: [PATCH] remove response from item_passed and item_dropped signal api --- docs/ref/signals.rst | 10 ++-------- scrapy/core/scraper.py | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/docs/ref/signals.rst b/docs/ref/signals.rst index 97d8a71bc..5e1435d6c 100644 --- a/docs/ref/signals.rst +++ b/docs/ref/signals.rst @@ -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 diff --git a/scrapy/core/scraper.py b/scrapy/core/scraper.py index f6a65c439..5bdaa115a 100644 --- a/scrapy/core/scraper.py +++ b/scrapy/core/scraper.py @@ -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)