Skip to content

Commit

Permalink
fix ITEM_PIPELINES setting handling
Browse files Browse the repository at this point in the history
* item_pipelines variable was unused so the fallback didn't work;
* added support for fallback in case of ITEM_PIPELINIES defined as set.
  • Loading branch information
kmike committed Sep 25, 2013
1 parent 61e89d8 commit b74e5aa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scrapy/contrib/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ class ItemPipelineManager(MiddlewareManager):
@classmethod
def _get_mwlist_from_settings(cls, settings):
item_pipelines = settings['ITEM_PIPELINES']
if isinstance(item_pipelines, (tuple, list)):
if isinstance(item_pipelines, (tuple, list, set, frozenset)):
from scrapy.exceptions import ScrapyDeprecationWarning
import warnings
warnings.warn('ITEM_PIPELINES defined as a list is deprecated, switch to a dict',
warnings.warn('ITEM_PIPELINES defined as a list or a set is deprecated, switch to a dict',
category=ScrapyDeprecationWarning, stacklevel=1)
# convert old ITEM_PIPELINE list to a dict with order 500
item_pipelines = dict(zip(item_pipelines, range(500, 500+len(item_pipelines))))
return build_component_list(settings['ITEM_PIPELINES_BASE'],
settings['ITEM_PIPELINES'])
return build_component_list(settings['ITEM_PIPELINES_BASE'], item_pipelines)

def _add_middleware(self, pipe):
super(ItemPipelineManager, self)._add_middleware(pipe)
Expand Down

0 comments on commit b74e5aa

Please sign in to comment.