Commit fda752eb9f07a9f28663c0ccb59e454e7625ae47
1 parent
ce842c5b
Exists in
master
and in
1 other branch
- fix show version information to use argparse's own way
- show in comments when external correct program aborts
Showing
4 changed files
with
7 additions
and
7 deletions
Show diff stats
.gitignore
package.json
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', '') | ... | ... |