mirror of https://github.com/scrapy/scrapy.git
Improve NotConfigured handling when clspath is a class.
This commit is contained in:
parent
f803ad63f3
commit
e58b8078f0
|
|
@ -40,12 +40,9 @@ class AddonManager:
|
|||
self.addons.append(addon)
|
||||
except NotConfigured as e:
|
||||
if e.args:
|
||||
clsname = (
|
||||
clspath.split(".")[-1] if isinstance(clspath, str) else clspath
|
||||
)
|
||||
logger.warning(
|
||||
"Disabled %(clsname)s: %(eargs)s",
|
||||
{"clsname": clsname, "eargs": e.args[0]},
|
||||
"Disabled %(clspath)s: %(eargs)s",
|
||||
{"clspath": clspath, "eargs": e.args[0]},
|
||||
extra={"crawler": self.crawler},
|
||||
)
|
||||
logger.info(
|
||||
|
|
|
|||
|
|
@ -46,10 +46,9 @@ class MiddlewareManager:
|
|||
enabled.append(clspath)
|
||||
except NotConfigured as e:
|
||||
if e.args:
|
||||
clsname = clspath.split(".")[-1]
|
||||
logger.warning(
|
||||
"Disabled %(clsname)s: %(eargs)s",
|
||||
{"clsname": clsname, "eargs": e.args[0]},
|
||||
"Disabled %(clspath)s: %(eargs)s",
|
||||
{"clspath": clspath, "eargs": e.args[0]},
|
||||
extra={"crawler": crawler},
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class MOff:
|
|||
pass
|
||||
|
||||
def __init__(self):
|
||||
raise NotConfigured
|
||||
raise NotConfigured("foo")
|
||||
|
||||
|
||||
class TestMiddlewareManager(MiddlewareManager):
|
||||
|
|
|
|||
Loading…
Reference in New Issue