Restored SpiderManager.close_spider() method but using signals instead of calling it from the engine

This commit is contained in:
Pablo Hoffman 2010-08-27 16:19:51 -03:00
parent 783887457a
commit 3234d76b8d
1 changed files with 6 additions and 1 deletions

View File

@ -3,9 +3,10 @@ SpiderManager is the class which locates and manages all website-specific
spiders
"""
from scrapy import log
from scrapy import log, signals
from scrapy.utils.misc import walk_modules
from scrapy.utils.spider import iter_spider_classes
from scrapy.xlib.pydispatch import dispatcher
class SpiderManager(object):
@ -16,6 +17,7 @@ class SpiderManager(object):
for name in self.spider_modules:
for module in walk_modules(name):
self._load_spiders(module)
dispatcher.connect(self.close_spider, signals.spider_closed)
def _load_spiders(self, module):
for spcls in iter_spider_classes(module):
@ -62,3 +64,6 @@ class SpiderManager(object):
def list(self):
"""Returns list of spiders available."""
return self._spiders.keys()
def close_spider(self, spider, reason):
pass