MediaPipeline fails to assign crawler.engine.download as download function because crawler is configured after pipelines are loaded

This commit is contained in:
Daniel Grana 2010-10-27 12:36:24 -02:00
parent 158f75450b
commit bc2d78406c
1 changed files with 7 additions and 1 deletions

View File

@ -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