mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-22 00:33:02 +00:00
ís_cached fix2
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%4088
This commit is contained in:
parent
e7fbaa50d8
commit
30202c54a4
@ -113,7 +113,7 @@ class Cache(object):
|
||||
def is_cached(self, domain, key):
|
||||
pickled_meta = os.path.join(self.requestpath(domain, key), 'pickled_meta')
|
||||
if os.path.exists(pickled_meta):
|
||||
with open(pickled_meta) as f:
|
||||
with open(pickled_meta, 'rb') as f:
|
||||
metadata = cPickle.load(f)
|
||||
if datetime.datetime.utcnow() <= metadata['timestamp'] + datetime.timedelta(seconds=settings.getint('CACHE2_EXPIRATION_SECS')):
|
||||
return True
|
||||
@ -133,7 +133,7 @@ class Cache(object):
|
||||
|
||||
requestpath = self.requestpath(domain, key)
|
||||
metadata = responsebody = responseheaders = None
|
||||
with open(os.path.join(requestpath, 'pickled_meta')) as f:
|
||||
with open(os.path.join(requestpath, 'pickled_meta'), 'rb') as f:
|
||||
metadata = cPickle.load(f)
|
||||
with open(os.path.join(requestpath, 'response_body')) as f:
|
||||
responsebody = f.read()
|
||||
|
Loading…
x
Reference in New Issue
Block a user