From c07e4ba1f40e7783f63aaf66ed6c4a283e3b8cca Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Tue, 10 Dec 2013 23:48:53 +0100 Subject: [PATCH] Fix argument parsing in linkchecker-nagios. --- doc/changelog.txt | 6 ++++-- linkchecker-nagios | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 2fb1f84b..e50b6280 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -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) diff --git a/linkchecker-nagios b/linkchecker-nagios index b34f1be2..e5a788ae 100755 --- a/linkchecker-nagios +++ b/linkchecker-nagios @@ -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()