Commit fda752eb9f07a9f28663c0ccb59e454e7625ae47

Authored by Miguel Barão
1 parent ce842c5b
Exists in master and in 1 other branch dev

- fix show version information to use argparse's own way

- show in comments when external correct program aborts
.gitignore
... ... @@ -15,4 +15,6 @@ package-lock.json
15 15 doc/
16 16  
17 17 # ignore mypy
18   -.mypy_cache/
19 18 \ No newline at end of file
  19 +.mypy_cache/
  20 +
  21 +build/
... ...
package.json
... ... @@ -6,7 +6,7 @@
6 6 "bootstrap": "^4.4.1",
7 7 "codemirror": "^5.53.2",
8 8 "datatables": "^1.10",
9   - "jquery": "^3.5.0",
  9 + "jquery": "^3.5.1",
10 10 "mathjax": "^3.0.5",
11 11 "popper.js": "^1.16.1",
12 12 "underscore": "^1.10"
... ...
perguntations/main.py
... ... @@ -48,7 +48,7 @@ def parse_cmdline_arguments():
48 48 parser.add_argument('--port',
49 49 type=int, default=8443,
50 50 help='port for the HTTPS server (default: 8443)')
51   - parser.add_argument('-v', '--version', action='store_true',
  51 + parser.add_argument('--version', action='version', version=APP_VERSION,
52 52 help='Show version information and exit')
53 53 return parser.parse_args()
54 54  
... ... @@ -110,10 +110,6 @@ def main():
110 110 '''
111 111 args = parse_cmdline_arguments()
112 112  
113   - if args.version:
114   - print(f'{APP_NAME} {APP_VERSION}\nPython {sys.version}')
115   - sys.exit(0)
116   -
117 113 # --- Setup logging ------------------------------------------------------
118 114 logging.config.dictConfig(get_logger_config(args.debug))
119 115 logging.info('====================== Start Logging ======================')
... ...
perguntations/questions.py
... ... @@ -493,6 +493,7 @@ class QuestionTextArea(Question):
493 493  
494 494 if out is None:
495 495 logger.warning('No grade after running "%s".', self["correct"])
  496 + self['comments'] = 'O programa de correcção abortou...'
496 497 self['grade'] = 0.0
497 498 elif isinstance(out, dict):
498 499 self['comments'] = out.get('comments', '')
... ... @@ -522,6 +523,7 @@ class QuestionTextArea(Question):
522 523  
523 524 if out is None:
524 525 logger.warning('No grade after running "%s".', self["correct"])
  526 + self['comments'] = 'O programa de correcção abortou...'
525 527 self['grade'] = 0.0
526 528 elif isinstance(out, dict):
527 529 self['comments'] = out.get('comments', '')
... ...