From fda752eb9f07a9f28663c0ccb59e454e7625ae47 Mon Sep 17 00:00:00 2001 From: Miguel Barão Date: Mon, 11 May 2020 18:27:08 +0100 Subject: [PATCH] - fix show version information to use argparse's own way - show in comments when external correct program aborts --- .gitignore | 4 +++- package.json | 2 +- perguntations/main.py | 6 +----- perguntations/questions.py | 2 ++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index e93dc0b..0c77018 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,6 @@ package-lock.json doc/ # ignore mypy -.mypy_cache/ \ No newline at end of file +.mypy_cache/ + +build/ diff --git a/package.json b/package.json index b0423c8..84cd88d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bootstrap": "^4.4.1", "codemirror": "^5.53.2", "datatables": "^1.10", - "jquery": "^3.5.0", + "jquery": "^3.5.1", "mathjax": "^3.0.5", "popper.js": "^1.16.1", "underscore": "^1.10" diff --git a/perguntations/main.py b/perguntations/main.py index 0f95544..52a44f1 100644 --- a/perguntations/main.py +++ b/perguntations/main.py @@ -48,7 +48,7 @@ def parse_cmdline_arguments(): parser.add_argument('--port', type=int, default=8443, help='port for the HTTPS server (default: 8443)') - parser.add_argument('-v', '--version', action='store_true', + parser.add_argument('--version', action='version', version=APP_VERSION, help='Show version information and exit') return parser.parse_args() @@ -110,10 +110,6 @@ def main(): ''' args = parse_cmdline_arguments() - if args.version: - print(f'{APP_NAME} {APP_VERSION}\nPython {sys.version}') - sys.exit(0) - # --- Setup logging ------------------------------------------------------ logging.config.dictConfig(get_logger_config(args.debug)) logging.info('====================== Start Logging ======================') diff --git a/perguntations/questions.py b/perguntations/questions.py index 6ca6e22..4b8622b 100644 --- a/perguntations/questions.py +++ b/perguntations/questions.py @@ -493,6 +493,7 @@ class QuestionTextArea(Question): if out is None: logger.warning('No grade after running "%s".', self["correct"]) + self['comments'] = 'O programa de correcção abortou...' self['grade'] = 0.0 elif isinstance(out, dict): self['comments'] = out.get('comments', '') @@ -522,6 +523,7 @@ class QuestionTextArea(Question): if out is None: logger.warning('No grade after running "%s".', self["correct"]) + self['comments'] = 'O programa de correcção abortou...' self['grade'] = 0.0 elif isinstance(out, dict): self['comments'] = out.get('comments', '') -- libgit2 0.21.2