Wed, 05 Jun 2019 00:33:50 +0300
show the filename of the processed file in the report
templates/webfront.html | file | annotate | diff | comparison | revisions | |
webfront.py | file | annotate | diff | comparison | revisions |
--- a/templates/webfront.html Tue Jun 04 23:58:30 2019 +0300 +++ b/templates/webfront.html Wed Jun 05 00:33:50 2019 +0300 @@ -16,25 +16,26 @@ <div class="report-container"> {% if report %} - <ul class="problems-list"> - {% for problem in report['problems'] %} - <li class="problem-{{problem['type']}}"> - <img - src="static/{{problem['type']}}.svg" - width="32" height="32" - class="problem-icon" - /> - Line {{problem['line-number']}}: {{problem['message']}} - <br /> - <span class="ldraw-code">{{problem['ldraw-code']}}</span> - </li> - {% endfor %} - </ul> + <h1>{{name}}</h1> + {% if report['problems'] %} + <ul class="problems-list"> + {% for problem in report['problems'] %} + <li class="problem-{{problem['type']}}"> + <img + src="static/{{problem['type']}}.svg" + width="32" height="32" + class="problem-icon" + /> + Line {{problem['line-number']}}: {{problem['message']}} + <br /> + <span class="ldraw-code">{{problem['ldraw-code']}}</span> + </li> + {% endfor %} + </ul> + {% else %} + No problems whatsoever. + {% endif %} {% endif %} -{% if report and not report['problems'] %} -No problems whatsoever. -{% endif %} - </div> </body> </html>
--- a/webfront.py Tue Jun 04 23:58:30 2019 +0300 +++ b/webfront.py Wed Jun 05 00:33:50 2019 +0300 @@ -13,13 +13,14 @@ if 'file' not in request.files or not request.files['file'].filename: return redirect(request.url) file = request.files['file'] + filename = file.filename config = load_config('ldcheck.cfg') for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): with ldconfig_ldr_path.open() as ldconfig_ldr: load_colours(ldconfig_ldr) model = read_ldraw( file.stream, - name = file.filename, + name = filename, ldraw_directories = config['libraries'], ) test_suite = load_tests() @@ -32,8 +33,10 @@ problem['ldraw-code'] = object.textual_representation() else: report = None + filename = None return render_template('webfront.html', report = report, + name = filename ) @app.route('/static/<path:path>')