replace numerated config entries with numerical ones

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3477 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2006-09-21 14:30:27 +00:00
parent d3e8b99ff2
commit 980fe1ea31
3 changed files with 94 additions and 12 deletions

View file

@ -20,6 +20,12 @@
Type: feature
Changed: linkcheck/director/__init__.py
* Replace all old "entry1, entry2" configuration entries with
multiline "entry" config entry.
Closes: SF patch #1562195
Type: feature
Changed: linkcheck/configuration/confparse.py
4.4 "Garden State" (released 16.9.2006)
* The JavaScript URL syntax check allows now digits and underscores.

View file

@ -134,20 +134,23 @@
#noanchorcaching=1
# filtering options
# for each extern link we can specify if it is strict or not
[filtering]
# ignore everything with 'lconline' in the URL name
#ignore1=lconline
# and ignore everything with 'bookmark' in the URL name
#ignore2=bookmark
# and ignore all mailto: URLs
#ignore3=^mailto:
#ignore=
# ignore everything with 'lconline' in the URL name
#lconline
# and ignore everything with 'bookmark' in the URL name
#bookmark
# and ignore all mailto: URLs
#^mailto:
# do not recurse into the following URLs
#nofollow1=http://justahomepage/bla
#nofollow=
# just a homepage
#http://justahomepage/bla
# specify hosts to contact directly without a proxy
# value is a regular expression
#noproxy1=*\.intra
#noproxy2=.*myinternurl.*
#noproxy=
#*\.intra
#.*myinternurl.*
# Ignore specified warnings (see linkchecker -h for the list of
# recognized warnings). Add a comma-separated list of warnings here
# that prevent a valid URL from being logged. Note that the warning
@ -165,5 +168,6 @@
# and therefore override the entries given here. The first match wins.
# At the moment, authentication is used/needed for http[s] and ftp links.
[authentication]
#entry1=^http://treasure\.calvinsplayground\.de/~calvin/isnichmehr/ lebowski lebowski
#entry2=^ftp://void.cs.uni-sb.de calvin hutzli
#entry=
#^http://treasure\.calvinsplayground\.de/~calvin/isnichmehr/ lebowski lebowski
#^ftp://void.cs.uni-sb.de calvin hutzli

View file

@ -167,9 +167,27 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
value = self.get(section, "noproxyfor")
for line in value.splitlines():
line = line.strip()
if not line or line.startswith('#'):
continue
try:
arg = re.compile(arg)
except re.error, msg:
raise linkcheck.LinkCheckerError(linkcheck.LOG_CHECK,
_("syntax error in noproxyfor %(line)r") % {"line": line})
self.config["noproxyfor"].append(arg)
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
# XXX backward compatibility
i = 1
while 1:
arg = self.get(section, "noproxyfor%d" % i)
linkcheck.log.warn(linkcheck.LOG_CHECK,
_("the noproxyfor%(num)d syntax is deprecated; use" \
"the new multiline configuration syntax") % {"num": i})
try:
arg = re.compile(arg)
except re.error, msg:
@ -192,9 +210,35 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
"""
section = "authentication"
try:
value = self.get(section, "entry")
for line in arg.splitlines():
line = line.strip()
if not line or line.startswith('#'):
continue
auth = line.split()
if len(auth) != 3:
raise linkcheck.LinkCheckerError(linkcheck.LOG_CHECK,
_("missing auth part in entry %(line)r") % \
{"line": line})
try:
auth[0] = re.compile(auth[0])
except re.error, msg:
raise linkcheck.LinkCheckerError(linkcheck.LOG_CHECK,
_("syntax error in entry %(line)r: %(msg)s") % \
{"line": line, "msg": msg})
self.config["authentication"].insert(0, {'pattern': auth[0],
'user': auth[1],
'password': auth[2]})
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
# XXX backward compatibility
i = 1
while 1:
auth = self.get(section, "entry%d" % i).split()
linkcheck.log.warn(linkcheck.LOG_CHECK,
_("the entry%(num)d syntax is deprecated; use" \
"the new multiline configuration syntax") % {"num": i})
if len(auth) != 3:
break
try:
@ -216,9 +260,23 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
"""
section = "filtering"
try:
value = self.get(section, "nofollow")
for line in arg.splitlines():
line = line.strip()
if not line or line.startswith('#'):
continue
pat = linkcheck.get_link_pat(line, strict=0)
self.config["externlinks"].append(pat)
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
# XXX backward compatibility
i = 1
while 1:
val = self.get(section, "nofollow%d" % i)
linkcheck.log.warn(linkcheck.LOG_CHECK,
_("the nofollow%(num)d syntax is deprecated; use" \
"the new multiline configuration syntax") % {"num": i})
pat = linkcheck.get_link_pat(val, strict=0)
self.config["externlinks"].append(pat)
i += 1
@ -230,10 +288,24 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
value = self.get(section, "ignore")
for line in arg.splitlines():
line = line.strip()
if not line or line.startswith('#'):
continue
pat = linkcheck.get_link_pat(line, strict=1)
self.config["externlinks"].append(pat)
except ConfigParser.Error, msg:
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK, msg)
try:
# XXX backward compatibility
i = 1
while 1:
# XXX backwards compatibility: split and ignore second part
val = self.get(section, "ignore%d" % i).split()[0]
linkcheck.log.warn(linkcheck.LOG_CHECK,
_("the ignore%(num)d syntax is deprecated; use" \
"the new multiline configuration syntax") % {"num": i})
pat = linkcheck.get_link_pat(val, strict=1)
self.config["externlinks"].append(pat)
i += 1