Scrapy, a fast high-level web crawling & scraping framework for Python.
Add middleware support for the 'no-store' Cache-Control directive.
Pedro Faustino0e435fb5f9a5
diff --git a/scrapy/contrib/downloadermiddleware/httpcache.py b/scrapy/contrib/downloadermiddleware/httpcache.pyindex e88371747..b1da47586 100644--- a/scrapy/contrib/downloadermiddleware/httpcache.py+++ b/scrapy/contrib/downloadermiddleware/httpcache.py@@ -83,11 +83,16 @@ class HttpCacheMiddleware(object):return responsedef is_cacheable_response(self, response):- return response.status not in self.ignore_http_codes+ retval = response.status not in self.ignore_http_codes+ if not self.use_dummy_cache and response.headers.has_key('cache-control'):+ retval = retval and (response.headers['cache-control'].lower().find('no-store') == -1)+ return retvaldef is_cacheable(self, request):- return urlparse_cached(request).scheme not in self.ignore_schemes-+ retval = urlparse_cached(request).scheme not in self.ignore_schemes+ if not self.use_dummy_cache and request.headers.has_key('cache-control'):+ retval = retval and (request.headers['cache-control'].lower().find('no-store') == -1)+ return retvalclass FilesystemCacheStorage(object):