Scrapy, a fast high-level web crawling & scraping framework for Python.
some py3 fixes for RFC2616Policy
Konstantin Lopuhin87849780bcf7
diff --git a/scrapy/extensions/httpcache.py b/scrapy/extensions/httpcache.pyindex 02f9fcee6..91b3ef262 100644--- a/scrapy/extensions/httpcache.py+++ b/scrapy/extensions/httpcache.py@@ -41,7 +41,8 @@ class RFC2616Policy(object):def __init__(self, settings):self.always_store = settings.getbool('HTTPCACHE_ALWAYS_STORE')self.ignore_schemes = settings.getlist('HTTPCACHE_IGNORE_SCHEMES')- self.ignore_response_cache_controls = settings.getlist('HTTPCACHE_IGNORE_RESPONSE_CACHE_CONTROLS')+ self.ignore_response_cache_controls = map(+ to_bytes, settings.getlist('HTTPCACHE_IGNORE_RESPONSE_CACHE_CONTROLS'))self._cc_parsed = WeakKeyDictionary()def _parse_cachecontrol(self, r):diff --git a/tests/test_downloadermiddleware_httpcache.py b/tests/test_downloadermiddleware_httpcache.pyindex 5a636cc53..4e0c72304 100644--- a/tests/test_downloadermiddleware_httpcache.py+++ b/tests/test_downloadermiddleware_httpcache.py@@ -291,7 +291,7 @@ class RFC2616PolicyTest(DefaultStorageTest):self.assertEqualResponse(res2, res3)# request with no-cache directive must not return cached response# but it allows new response to be stored- res0b = res0.replace(body='foo')+ res0b = res0.replace(body=b'foo')res4 = self._process_requestresponse(mw, req2, res0b)self.assertEqualResponse(res4, res0b)assert 'cached' not in res4.flags@@ -435,7 +435,7 @@ class RFC2616PolicyTest(DefaultStorageTest):assert 'cached' not in res1.flags# Same request but as cached response is stale a new response must# be returned- res0b = res0a.replace(body='bar')+ res0b = res0a.replace(body=b'bar')res2 = self._process_requestresponse(mw, req0, res0b)self.assertEqualResponse(res2, res0b)assert 'cached' not in res2.flags