spider manager: added protection to avoid reloading non-spider modules

This commit is contained in:
Pablo Hoffman 2009-09-02 20:43:05 -03:00
parent 11f296b753
commit 37929f42b3
1 changed files with 6 additions and 4 deletions

View File

@ -117,7 +117,9 @@ class TwistedPluginSpiderManager(object):
spider
"""
module_name = spider.__module__
log.msg("Reloading module %s" % module_name, domain=domain, \
level=log.DEBUG)
new_module = rebuild(sys.modules[module_name], doLog=0)
self._spiders[domain] = new_module.SPIDER
module = sys.modules[module_name]
if hasattr(module, 'SPIDER'):
log.msg("Reloading module %s" % module_name, domain=domain, \
level=log.DEBUG)
new_module = rebuild(module, doLog=0)
self._spiders[domain] = new_module.SPIDER