scrapy / scrapy
1
"""
2
Item pipeline
3

4
See documentation in docs/item-pipeline.rst
5
"""
6

7 7
from scrapy.middleware import MiddlewareManager
8 7
from scrapy.utils.conf import build_component_list
9 7
from scrapy.utils.defer import deferred_f_from_coro_f
10

11

12 7
class ItemPipelineManager(MiddlewareManager):
13

14 7
    component_name = 'item pipeline'
15

16 7
    @classmethod
17 4
    def _get_mwlist_from_settings(cls, settings):
18 7
        return build_component_list(settings.getwithbase('ITEM_PIPELINES'))
19

20 7
    def _add_middleware(self, pipe):
21 7
        super(ItemPipelineManager, self)._add_middleware(pipe)
22 7
        if hasattr(pipe, 'process_item'):
23 7
            self.methods['process_item'].append(deferred_f_from_coro_f(pipe.process_item))
24

25 7
    def process_item(self, item, spider):
26 7
        return self._process_chain('process_item', item, spider)

Read our documentation on viewing source code .

Loading