arg_to_iter: replaced double call to isinstance with a single one. refs #248

This commit is contained in:
Pablo Hoffman 2013-02-27 03:51:23 -02:00
parent 2bbd92742b
commit 3a6b80259d
3 changed files with 3 additions and 2 deletions

View File

@ -233,6 +233,7 @@ class ExecutionEngine(object):
next loop and this function is guaranteed to be called (at least) once
again for this spider.
"""
print ">>> spider_idle!"
res = self.signals.send_catch_log(signal=signals.spider_idle, \
spider=spider, dont_log=DontCloseSpider)
if any(isinstance(x, Failure) and isinstance(x.value, DontCloseSpider) \

View File

@ -3,7 +3,7 @@ from scrapy.utils import signal
class SignalManager(object):
def __init__(self, sender=dispatcher.Anonymous):
def __init__(self, sender=dispatcher.Any):
self.sender = sender
def connect(self, *a, **kw):

View File

@ -16,7 +16,7 @@ def arg_to_iter(arg):
"""
if arg is None:
return []
elif not isinstance(arg, dict) and not isinstance(arg, BaseItem) and hasattr(arg, '__iter__'):
elif not isinstance(arg, (dict, BaseItem)) and hasattr(arg, '__iter__'):
return arg
else:
return [arg]