Fix warning to duplicated spider. Issue 2181

This commit is contained in:
MrMenezes 2016-10-21 18:02:16 -03:00 committed by Paul Tremberth
parent 7b49b9c0f5
commit f3b75c940d
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,12 @@ class SpiderLoader(object):
def _load_spiders(self, module):
for spcls in iter_spider_classes(module):
self._spiders[spcls.name] = spcls
if spcls.name in self._spiders.keys():
import warnings
warnings.warn("There are several spiders with the same name (" + spcls.name +
"), this can cause unexpected behavior", UserWarning)
self._spiders[spcls.name] = spcls
def _load_all_spiders(self):
for name in self.spider_modules: