From 0f690b03dc216424f7c92bf06a2ba0864bfa390f Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Thu, 28 May 2009 13:57:25 -0300 Subject: [PATCH] added deprecation warning to ErrorPages downloader middleware --- scrapy/contrib/downloadermiddleware/errorpages.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scrapy/contrib/downloadermiddleware/errorpages.py b/scrapy/contrib/downloadermiddleware/errorpages.py index a665cbf81..a55f452b0 100644 --- a/scrapy/contrib/downloadermiddleware/errorpages.py +++ b/scrapy/contrib/downloadermiddleware/errorpages.py @@ -1,3 +1,5 @@ +import warnings + from scrapy.core.exceptions import IgnoreRequest from scrapy.utils.response import response_status_message @@ -8,6 +10,10 @@ class ErrorPagesMiddleware(object): TODO: move this mw to spidermiddleware and remove me """ + def __init__(self): + warnings.warn("scrapy.contrib.downloadermiddleware.errorpages.ErrorPagesMiddleware downloader middleware is deprecated - use scrapy.contrib.spidermiddleware.httperror.HttpErrorMiddleware spider middleware instead", + DeprecationWarning, stacklevel=2) + def process_response(self, request, response, spider): status = response.status if 200 <= status < 300 or status in getattr(spider, 'handle_httpstatus_list', []):