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__": ...@@ -39,35 +39,33 @@ if __name__ == "__main__":
WEB2PY = os.path.join(WEB2PY_DIR, 'web2py.py') WEB2PY = os.path.join(WEB2PY_DIR, 'web2py.py')
# command line options # command line options
parser = ArgumentParser() PARSER = ArgumentParser()
parser.add_argument('-a', '--app', PARSER.add_argument('-a', '--app',
default=APP, default=APP,
dest='application', dest='application',
help='the name of the application.') help='the name of the application.')
parser.add_argument('script', PARSER.add_argument('script',
help='the name of the script to be run.') help='the name of the script to be run.')
parser.add_argument('args', PARSER.add_argument('args',
nargs='*', nargs='*',
help='the arguments for the script.') help='the arguments for the script.')
args = parser.parse_args() ARGS = PARSER.parse_args()
# run the script in the application context # run the script in the application context
script_path = os.path.join(os.getcwd(), args.script) CMD = [WEB2PY,
cmd = [WEB2PY,
'--no-banner', '--no-banner',
'--shell', args.application, '--shell', ARGS.application,
'--import_models', '--import_models',
'--run', script_path] '--run', os.path.join(os.getcwd(), ARGS.script)]
if args.args: if ARGS.args:
cmd.append('--args') CMD.append('--ARGS')
cmd.extend(args.args) CMD.extend(ARGS.args)
return_code = subprocess.call(cmd) RETURN_CODE = subprocess.call(CMD)
# exit # 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