mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-03 06:30:23 +00:00
do not parse any invalid config files
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2895 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
9f65e8811a
commit
d83720f05d
2 changed files with 12 additions and 9 deletions
|
|
@ -234,12 +234,12 @@ class Configuration (dict):
|
|||
# system wide config settings
|
||||
config_dir = _linkchecker_configdata.config_dir
|
||||
path = normpath(os.path.join(config_dir, "linkcheckerrc"))
|
||||
if os.path.exists(path):
|
||||
cfiles.append(path)
|
||||
cfiles.append(path)
|
||||
# per user config settings
|
||||
path = normpath("~/.linkchecker/linkcheckerrc")
|
||||
if os.path.exists(path):
|
||||
cfiles.append(path)
|
||||
cfiles.append(path)
|
||||
# weed out invalid files
|
||||
cfiles = [f for f in cfiles if os.path.isfile(f)]
|
||||
self.read_config(cfiles)
|
||||
# re-init logger
|
||||
self['logger'] = self.logger_new('text')
|
||||
|
|
|
|||
13
linkchecker
13
linkchecker
|
|
@ -488,7 +488,6 @@ if has_optcomplete:
|
|||
|
||||
# read and parse command line options and arguments
|
||||
(options, args) = optparser.parse_args()
|
||||
|
||||
# build a config object for this check session
|
||||
config = linkcheck.configuration.Configuration()
|
||||
# initialize logging
|
||||
|
|
@ -505,14 +504,18 @@ if options.trace:
|
|||
options.psyco = False
|
||||
|
||||
config.init_logging(debug=options.debug)
|
||||
linkcheck.log.debug(linkcheck.LOG_CMDLINE, "Python %s on %s",
|
||||
linkcheck.log.debug(linkcheck.LOG_CMDLINE, _("Python %s on %s"),
|
||||
sys.version, sys.platform)
|
||||
# read configuration files
|
||||
try:
|
||||
files = []
|
||||
if options.configfile:
|
||||
config.read(files=[options.configfile])
|
||||
else:
|
||||
config.read()
|
||||
if os.path.isfile(options.configfile):
|
||||
files.append(options.configfile)
|
||||
else:
|
||||
linkcheck.log.warn(linkcheck.LOG_CMDLINE,
|
||||
_("Unreadable config file: %r"), options.configfile)
|
||||
config.read(files=files)
|
||||
except linkcheck.LinkCheckerError, msg:
|
||||
# config error
|
||||
print_usage(str(msg))
|
||||
|
|
|
|||
Loading…
Reference in a new issue