Scrapy, a fast high-level web crawling & scraping framework for Python.
parse command: fix crash in case of bad callback
Alex Cepoi0350bed8fd29
diff --git a/scrapy/commands/parse.py b/scrapy/commands/parse.pyindex 3e01c771d..a1b7849f1 100644--- a/scrapy/commands/parse.py+++ b/scrapy/commands/parse.py@@ -152,9 +152,14 @@ class Command(ScrapyCommand):else:cb = 'parse'- cb = cb if callable(cb) else getattr(self.spider, cb, None)- if not cb:- log.msg('Cannot find callback %r in spider: %s' % (callback, self.spider.name))+ if not callable(cb):+ cb_method = getattr(self.spider, cb, None)+ if callable(cb_method):+ cb = cb_method+ else:+ log.msg('Cannot find callback %r in spider: %s' % \+ (cb, self.spider.name), level=log.ERROR)+ return# parse items and requestsdepth = response.meta['_depth']