Commit b52a0024 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

the run script pass plint checks.

parent eb274b13
......@@ -39,35 +39,33 @@ if __name__ == "__main__":
WEB2PY = os.path.join(WEB2PY_DIR, 'web2py.py')
# command line options
parser = ArgumentParser()
parser.add_argument('-a', '--app',
PARSER = ArgumentParser()
PARSER.add_argument('-a', '--app',
default=APP,
dest='application',
help='the name of the application.')
parser.add_argument('script',
PARSER.add_argument('script',
help='the name of the script to be run.')
parser.add_argument('args',
PARSER.add_argument('args',
nargs='*',
help='the arguments for the script.')
args = parser.parse_args()
ARGS = PARSER.parse_args()
# run the script in the application context
script_path = os.path.join(os.getcwd(), args.script)
cmd = [WEB2PY,
CMD = [WEB2PY,
'--no-banner',
'--shell', args.application,
'--shell', ARGS.application,
'--import_models',
'--run', script_path]
'--run', os.path.join(os.getcwd(), ARGS.script)]
if args.args:
cmd.append('--args')
cmd.extend(args.args)
if ARGS.args:
CMD.append('--ARGS')
CMD.extend(ARGS.args)
return_code = subprocess.call(cmd)
RETURN_CODE = subprocess.call(CMD)
# exit
sys.exit(return_code)
sys.exit(RETURN_CODE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment