Skip to content

Commit

Permalink
Merge pull request #1161 from scrapy/telnet-disable
Browse files Browse the repository at this point in the history
disable scrapy.telnet if twisted.conch is not available
  • Loading branch information
dangra committed Apr 15, 2015
2 parents e3aaeb7 + 378b6ef commit c013baa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions scrapy/telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

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
Expand All @@ -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')]
Expand Down
1 change: 0 additions & 1 deletion tests/py3-ignores.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c013baa

Please sign in to comment.