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