From bb4e183c15e3a15aa070a99785340629fe84de93 Mon Sep 17 00:00:00 2001 From: jiazeh <45085050+jiazeh@users.noreply.github.com> Date: Fri, 13 Aug 2021 14:44:01 +0800 Subject: [PATCH] Update item_cache.py Update => load_pipelines function --- fastspider/cache/item_cache.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fastspider/cache/item_cache.py b/fastspider/cache/item_cache.py index b116251..415a682 100644 --- a/fastspider/cache/item_cache.py +++ b/fastspider/cache/item_cache.py @@ -94,14 +94,14 @@ def load_pipelines(self): :return: """ pipelines = [] - for pipeline in common.ITEM_PIPELINES: - module, class_name = pipeline.rsplit(".", 1) + for pipeline_path in common.ITEM_PIPELINES: + module, class_name = pipeline_path.rsplit(".", 1) pipeline_cls = importlib.import_module(module).__getattribute__(class_name) - - if not isinstance(pipeline_cls(), BasePipeline): + pipeline = pipeline_cls() + if not isinstance(pipeline, BasePipeline): raise Exception(f"{class_name}必须继承 BasePipeline ") - pipelines.append(pipeline_cls()) + pipelines.append(pipeline) return pipelines def __save_item_to_db(self, table_name, item_data, is_update=False):