Fix argument parsing in linkchecker-nagios.

This commit is contained in:
Bastian Kleineidam 2013-12-10 23:48:53 +01:00
parent 78ed1e9e52
commit c07e4ba1f4
2 changed files with 11 additions and 7 deletions

View file

@ -3,8 +3,6 @@
Features:
- checking: Make per-host connection limits configurable.
- checking: Avoid DoS in SSL certificate host matcher.
- checking: Do not use GET on POST forms.
Closes: GH bug #405
Changes:
- checking: Always use the W3C validator to check HTML or CSS syntax.
@ -20,6 +18,10 @@ Fixes:
Content-Type on HEAD requests. Automatically fallback to GET in this
case.
Closes: GH bug #414
- checking: Do not use GET on POST forms.
Closes: GH bug #405
- scripts: Fix argument parsing in linkchecker-nagios
Closes: GH bug #404
8.4 "Frankenweenie" (released 25.01.2013)

View file

@ -28,10 +28,9 @@ import pprint
# installs _() and _n() gettext functions into global namespace
import linkcheck
# override argparse gettext method with the one from linkcheck.init_i18n()
argparse._ = _
#argparse._ = _
# now import the rest of the linkchecker gang
from linkcheck.cmdline import print_version, print_usage, LCHelpFormatter, \
aggregate_url
from linkcheck.cmdline import print_version, print_usage, aggregate_url, LCArgumentParser
from linkcheck import log, LOG_CMDLINE, strformat
import linkcheck.checker
import linkcheck.configuration
@ -55,12 +54,15 @@ Epilog = u"\n".join((Retval, Examples))
# instantiate option parser and configure options
class ArgumentParser(argparse.ArgumentParser):
class ArgumentParser(LCArgumentParser):
def error(self, message):
self.print_usage(sys.stderr)
self.exit(3, _('%s: error: %s\n') % (self.prog, message))
argparser = ArgumentParser(formatter_class=LCHelpFormatter, epilog=Epilog)
argparser = ArgumentParser(
epilog=Epilog,
formatter_class=argparse.RawDescriptionHelpFormatter
)
# build a config object for this check session
config = linkcheck.configuration.Configuration()