1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 12:44:06 +00:00

Merge pull request #1161 from scrapy/telnet-disable

disable scrapy.telnet if twisted.conch is not available
This commit is contained in:
Daniel Graña 2015-04-15 00:32:42 -03:00
commit c013baa602
2 changed files with 8 additions and 3 deletions

View File

@ -6,9 +6,13 @@ See documentation in docs/topics/telnetconsole.rst
import pprint
from twisted.conch import manhole, telnet
from twisted.conch.insults import insults
from twisted.internet import protocol
try:
from twisted.conch import manhole, telnet
from twisted.conch.insults import insults
TWISTED_CONCH_AVAILABLE = True
except ImportError:
TWISTED_CONCH_AVAILABLE = False
from scrapy.exceptions import NotConfigured
from scrapy import log, signals
@ -32,6 +36,8 @@ class TelnetConsole(protocol.ServerFactory):
def __init__(self, crawler):
if not crawler.settings.getbool('TELNETCONSOLE_ENABLED'):
raise NotConfigured
if not TWISTED_CONCH_AVAILABLE:
raise NotConfigured
self.crawler = crawler
self.noisy = False
self.portrange = [int(x) for x in crawler.settings.getlist('TELNETCONSOLE_PORT')]

View File

@ -96,5 +96,4 @@ scrapy/contrib/statsmailer.py
scrapy/contrib/memusage.py
scrapy/commands/deploy.py
scrapy/commands/bench.py
scrapy/telnet.py
scrapy/mail.py