mirror of https://github.com/scrapy/scrapy.git
mediapipeline: change cache variable by domaininfo
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40246
This commit is contained in:
parent
41a4f22c27
commit
5048491f8d
|
|
@ -21,16 +21,16 @@ class DomainInfo(object):
|
|||
|
||||
class MediaPipeline(object):
|
||||
def __init__(self):
|
||||
self.cache = {}
|
||||
self.domaininfo = {}
|
||||
|
||||
def open_domain(self, domain):
|
||||
self.cache[domain] = DomainInfo(domain)
|
||||
self.domaininfo[domain] = DomainInfo(domain)
|
||||
|
||||
def close_domain(self, domain):
|
||||
del self.cache[domain]
|
||||
del self.domaininfo[domain]
|
||||
|
||||
def process_item(self, domain, response, item):
|
||||
info = self.cache[domain]
|
||||
info = self.domaininfo[domain]
|
||||
requests = self.get_media_requests(item, info)
|
||||
assert requests is None or hasattr(requests, '__iter__'), \
|
||||
'get_media_requests should return None or iterable'
|
||||
|
|
|
|||
Loading…
Reference in New Issue