diff -r f0a6bf48b05e -r 8949af6a4279 webfront.py --- a/webfront.py Sat Jun 08 01:32:25 2019 +0300 +++ b/webfront.py Sat Jun 08 01:42:48 2019 +0300 @@ -2,12 +2,13 @@ from flask import Flask, render_template, redirect, request from ldcheck import load_config, load_colours, find_ldconfig_ldr_paths from parse import read_ldraw -from testsuite import load_tests, check_model, problem_text +from testsuite import load_tests, check_model, problem_text, all_problem_types app = Flask('LDCheck') @app.route('/', methods = ['GET', 'POST']) def web_front(): + test_suite = load_tests() if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files or not request.files['file'].filename: @@ -23,7 +24,6 @@ name = filename, ldraw_directories = config['libraries'], ) - test_suite = load_tests() report = check_model(model, test_suite) # Amend human-readable messages into the report @@ -31,13 +31,18 @@ object = model.body[problem.body_index] problem.message_str = problem_text(problem, test_suite) problem.ldraw_code = object.textual_representation() + return render_template('webfront.html', + report = report, + name = filename, + problem_types = all_problem_types(test_suite) + ) else: - report = None - filename = None - return render_template('webfront.html', - report = report, - name = filename - ) + test_suite = load_tests() + return render_template('webfront.html', + report = None, + name = None, + problem_types = all_problem_types(test_suite) + ) @app.route('/static/') def static_file(path):