mirror of https://github.com/scrapy/scrapy.git
MediaPipeline fails to assign crawler.engine.download as download function because crawler is configured after pipelines are loaded
This commit is contained in:
parent
158f75450b
commit
bc2d78406c
|
|
@ -20,7 +20,13 @@ class MediaPipeline(object):
|
|||
|
||||
def __init__(self, download_func=None):
|
||||
self.spiderinfo = {}
|
||||
self._download_func = download_func or self._default_download_func()
|
||||
self._cached_download_func = download_func
|
||||
|
||||
@property
|
||||
def _download_func(self):
|
||||
if self._cached_download_func is None:
|
||||
self._cached_download_func = self._default_download_func()
|
||||
return self._cached_download_func
|
||||
|
||||
def _default_download_func(self):
|
||||
from scrapy.project import crawler
|
||||
|
|
|
|||
Loading…
Reference in New Issue