[FIX] cli: start command path option does not work

Using the `start` CLI command with the `--path` or `-p` option arrors with:

    odoo.py: error: no such option: --path

This is because the `--path` option is passed on the server start routine,
and it's invalid there.
A workaround is to remove those command options from the arguments passed
to the main() server start.

Closes #5896
This commit is contained in:
Daniel Reis 2015-03-23 15:13:48 +00:00 committed by Nicolas Martinelli
parent 066e41b63d
commit 8880edd4fb
1 changed files with 7 additions and 0 deletions

View File

@ -61,6 +61,13 @@ class Start(Command):
if '--db-filter' not in cmdargs:
cmdargs.append('--db-filter=^%s$' % args.db_name)
# Remove --path /-p options from the command arguments
def to_remove(i, l):
return l[i] == '-p' or l[i].startswith('--path') or \
(i > 0 and l[i-1] in ['-p', '--path'])
cmdargs = [v for i, v in enumerate(cmdargs)
if not to_remove(i, cmdargs)]
main(cmdargs)
def die(message, code=1):