[MERGE] merged Julien Thewys branch to disallow unrecognized command line parameters.
bzr revid: vmt@openerp.com-20110418131023-mza0x2yo075xj0qb
This commit is contained in:
commit
c2a752321b
|
@ -251,12 +251,14 @@ class configmanager(object):
|
||||||
self.parse_config()
|
self.parse_config()
|
||||||
|
|
||||||
def parse_config(self, args=[]):
|
def parse_config(self, args=[]):
|
||||||
opt = self.parser.parse_args(args)[0]
|
opt, args = self.parser.parse_args()
|
||||||
|
|
||||||
def die(cond, msg):
|
def die(cond, msg):
|
||||||
if cond:
|
if cond:
|
||||||
print msg
|
self.parser.error(msg)
|
||||||
sys.exit(1)
|
|
||||||
|
# Ensures no illegitimate argument is silently discarded (avoids insidious "hyphen to dash" problem)
|
||||||
|
die(args, "unrecognized parameters: '%s'" % " ".join(args))
|
||||||
|
|
||||||
die(bool(opt.syslog) and bool(opt.logfile),
|
die(bool(opt.syslog) and bool(opt.logfile),
|
||||||
"the syslog and logfile options are exclusive")
|
"the syslog and logfile options are exclusive")
|
||||||
|
|
Loading…
Reference in New Issue