diff --git a/linkcheck/checker/nntpurl.py b/linkcheck/checker/nntpurl.py index 4e074586..07b5e87a 100644 --- a/linkcheck/checker/nntpurl.py +++ b/linkcheck/checker/nntpurl.py @@ -72,7 +72,7 @@ class NntpUrl (urlbase.UrlBase): later", are caught. """ tries = 0 - nntp = value = None + nntp = None while tries < 2: tries += 1 try: diff --git a/linkcheck/checker/urlbase.py b/linkcheck/checker/urlbase.py index 784986e8..98ad60c5 100644 --- a/linkcheck/checker/urlbase.py +++ b/linkcheck/checker/urlbase.py @@ -433,8 +433,8 @@ class UrlBase (object): return # check for obfuscated IP address if iputil.is_obfuscated_ip(self.host): - ips = iputil.resolve_host(self.host) - if ips: + ips = iputil.resolve_host(self.host) + if ips: self.add_warning( _("URL %(url)s has obfuscated IP address %(ip)s") % \ {"url": self.base_url, "ip": ips.pop()}, diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py index dfdb69e4..4b6cd4d9 100644 --- a/linkcheck/configuration/__init__.py +++ b/linkcheck/configuration/__init__.py @@ -327,7 +327,7 @@ class Configuration (dict): """Make anchor configuration consistent.""" if not self["warnings"]: self["warnings"] = True - from ..checker import Warnings + from ..checker.const import Warnings self["ignorewarnings"] = Warnings.keys() if 'url-anchor-not-found' in self["ignorewarnings"]: self["ignorewarnings"].remove('url-anchor-not-found') @@ -432,9 +432,9 @@ def get_standard_config_files (): if not os.path.exists(userdir): os.makedirs(userdir) shutil.copy(syspath, userpath) - except StandardError, msg: + except StandardError: log.warn(LOG_CHECK, "could not copy system config from %r to %r", - syspath, userpath) + syspath, userpath, traceback=True) return (syspath, userpath) @@ -633,7 +633,7 @@ def add_kde_setting (key, value, data): elif key == "Proxy Config Script": data["autoconfig_url"] = value elif key == "httpProxy": - add_kde_proxy("http_proxy", value, data) + add_kde_proxy("http_proxy", value, data) elif key == "httpsProxy": add_kde_proxy("https_proxy", value, data) elif key == "ftpProxy": diff --git a/linkcheck/httputil.py b/linkcheck/httputil.py index ace317bc..0d389c46 100644 --- a/linkcheck/httputil.py +++ b/linkcheck/httputil.py @@ -71,9 +71,9 @@ if hasattr(httplib, 'HTTPS'): class HttpsWithGzipHandler (urllib2.HTTPSHandler): """Support gzip encoding.""" - def http_open (self, req): + def https_open (self, req): """Send request and decode answer.""" - return decode(urllib2.HTTPSHandler.http_open(self, req)) + return decode(urllib2.HTTPSHandler.https_open(self, req)) # end of urlutils.py routines ########################################################################### diff --git a/linkchecker b/linkchecker index a9516886..e63434af 100755 --- a/linkchecker +++ b/linkchecker @@ -27,7 +27,8 @@ import os import pprint import socket import optparse - +import getpass +# installs _() and _n() gettext functions into global namespace import linkcheck # override optparse gettext method with the one from linkcheck.init_i18n() optparse._ = _ @@ -657,7 +658,6 @@ if options.password: {"user": _username} else: msg = _("Enter LinkChecker HTTP/FTP password:") - import getpass _password = getpass.getpass(console.encode(msg)) constructauth = True if options.pause is not None: @@ -723,7 +723,6 @@ for entry in config["authentication"]: attrs["strpattern"] = attrs["pattern"].pattern msg = _("Enter LinkChecker password for user %(user)s" \ " at %(strpattern)s:") % attrs - import getpass entry["password"] = getpass.getpass(console.encode(msg)) # now sanitize the configuration config.sanitize()