1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 06:24:00 +00:00

[image_pipeline] minor style tweaks

This commit is contained in:
Pawel Miech 2016-07-13 16:17:34 +02:00
parent 9818c97f6e
commit ceecf3b26c

View File

@ -48,22 +48,23 @@ class ImagesPipeline(FilesPipeline):
DEFAULT_IMAGES_RESULT_FIELD = 'images'
def __init__(self, store_uri, download_func=None, settings=None):
super(ImagesPipeline, self).__init__(store_uri, settings=settings, download_func=download_func)
super(ImagesPipeline, self).__init__(store_uri, settings=settings,
download_func=download_func)
if isinstance(settings, dict) or settings is None:
settings = Settings(settings)
cls_name = "ImagesPipeline"
resolve = functools.partial(self._key_for_pipe,
base_class_name="ImagesPipeline")
self.expires = settings.getint(
self._key_for_pipe('IMAGES_EXPIRES', cls_name), self.EXPIRES
resolve("IMAGES_EXPIRES"), self.EXPIRES
)
if not hasattr(self, "IMAGES_RESULT_FIELD"):
self.IMAGES_RESULT_FIELD = self.DEFAULT_IMAGES_RESULT_FIELD
if not hasattr(self, "IMAGES_URLS_FIELD"):
self.IMAGES_URLS_FIELD = self.DEFAULT_IMAGES_URLS_FIELD
resolve = functools.partial(self._key_for_pipe, base_class_name=cls_name)
self.images_urls_field = settings.get(
resolve('IMAGES_URLS_FIELD'),
self.IMAGES_URLS_FIELD