mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-25 22:43:57 +00:00
raise NotConfigured in web/telnetconsole when disabled
This commit is contained in:
parent
8fab524978
commit
60299c49ca
@ -11,6 +11,7 @@ from twisted.conch.insults import insults
|
|||||||
from twisted.internet import reactor, protocol
|
from twisted.internet import reactor, protocol
|
||||||
|
|
||||||
from scrapy.extension import extensions
|
from scrapy.extension import extensions
|
||||||
|
from scrapy.core.exceptions import NotConfigured
|
||||||
from scrapy.core.manager import scrapymanager
|
from scrapy.core.manager import scrapymanager
|
||||||
from scrapy.core.engine import scrapyengine
|
from scrapy.core.engine import scrapyengine
|
||||||
from scrapy.spider import spiders
|
from scrapy.spider import spiders
|
||||||
@ -47,7 +48,7 @@ class TelnetConsole(protocol.ServerFactory):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if not settings.getbool('TELNETCONSOLE_ENABLED'):
|
if not settings.getbool('TELNETCONSOLE_ENABLED'):
|
||||||
return
|
raise NotConfigured
|
||||||
self.protocol = makeProtocol
|
self.protocol = makeProtocol
|
||||||
self.noisy = False
|
self.noisy = False
|
||||||
port = settings.getint('TELNETCONSOLE_PORT')
|
port = settings.getint('TELNETCONSOLE_PORT')
|
||||||
|
@ -10,8 +10,9 @@ from datetime import datetime
|
|||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.web import server, resource
|
from twisted.web import server, resource
|
||||||
from scrapy.xlib.pydispatch import dispatcher
|
|
||||||
|
|
||||||
|
from scrapy.xlib.pydispatch import dispatcher
|
||||||
|
from scrapy.core.exceptions import NotConfigured
|
||||||
from scrapy.core.engine import scrapyengine
|
from scrapy.core.engine import scrapyengine
|
||||||
from scrapy.conf import settings
|
from scrapy.conf import settings
|
||||||
|
|
||||||
@ -84,8 +85,7 @@ class WebConsole(server.Site):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if not settings.getbool('WEBCONSOLE_ENABLED'):
|
if not settings.getbool('WEBCONSOLE_ENABLED'):
|
||||||
return
|
raise NotConfigured
|
||||||
|
|
||||||
logfile = settings['WEBCONSOLE_LOGFILE']
|
logfile = settings['WEBCONSOLE_LOGFILE']
|
||||||
server.Site.__init__(self, WebConsoleResource(), logPath=logfile)
|
server.Site.__init__(self, WebConsoleResource(), logPath=logfile)
|
||||||
self.noisy = False
|
self.noisy = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user