mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 18:23:57 +00:00
parse command: fix crash in case of bad callback
This commit is contained in:
parent
4ec99117d3
commit
0350bed8fd
@ -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 requests
|
||||
depth = response.meta['_depth']
|
||||
|
Loading…
x
Reference in New Issue
Block a user