mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-16 12:21:13 +00:00
Improve warning about missing twill module.
This commit is contained in:
parent
bcbacec79a
commit
f6f43ffba8
2 changed files with 13 additions and 2 deletions
|
|
@ -21,7 +21,8 @@ import os
|
|||
import thread
|
||||
import urlparse
|
||||
from cStringIO import StringIO
|
||||
from .. import log, LOG_CHECK, LinkCheckerInterrupt, cookies, dummy, fileutil
|
||||
from .. import log, LOG_CHECK, LinkCheckerInterrupt, cookies, dummy, \
|
||||
fileutil, strformat
|
||||
from ..cache import urlqueue, robots_txt, cookie, connection
|
||||
from . import aggregator, console
|
||||
from ..httplib2 import HTTPMessage
|
||||
|
|
@ -34,7 +35,10 @@ def visit_loginurl (aggregate):
|
|||
if not url:
|
||||
return
|
||||
if not fileutil.has_module("twill"):
|
||||
log.warn(LOG_CHECK, _("Could not import twill for login URL visit"))
|
||||
msg = strformat.format_feature_warning(module=u'twill',
|
||||
feature=u'login URL visit',
|
||||
url=u'http://twill.idyll.org/')
|
||||
log.warn(LOG_CHECK, msg)
|
||||
return
|
||||
from twill import commands as tc
|
||||
log.debug(LOG_CHECK, u"Visiting login URL %s", url)
|
||||
|
|
|
|||
|
|
@ -304,3 +304,10 @@ def limit (s, length=72):
|
|||
def strline (s):
|
||||
"""Display string representation on one line."""
|
||||
return u"`%s'" % unicode(s).replace(u"\n", u"\\n")
|
||||
|
||||
|
||||
def format_feature_warning (**kwargs):
|
||||
"""Format warning that a module could not be imported and that it should
|
||||
be installed for a certain URL.
|
||||
"""
|
||||
return _("Could not import %(module)s for %(feature)s. Install %(module)s from %(url)s to use this feature.") % kwargs
|
||||
|
|
|
|||
Loading…
Reference in a new issue