webfront.py

changeset 99
01941a811b5a
parent 63
8949af6a4279
child 100
62759e5c4554
--- a/webfront.py	Tue Aug 25 22:08:30 2020 +0300
+++ b/webfront.py	Tue Aug 25 22:10:04 2020 +0300
@@ -6,6 +6,22 @@
 
 app = Flask('LDCheck')
 
+def format_report_html(report, model, test_suite):
+    messages = []
+    for problem in report['problems']:
+        ldraw_code = model.body[problem.body_index].textual_representation()
+        message = str.format(
+            '<li class="{problem_type}">{model_name}:{line_number}:'
+            '{problem_type}: {message}<br />{ldraw_code}</li>',
+            model_name = model.name,
+            line_number = problem.line_number,
+            problem_type = problem.severity,
+            message = problem_text(problem, test_suite),
+            ldraw_code = ldraw_code,
+        )
+        messages.append(message)
+    return '\n'.join(messages)
+
 @app.route('/', methods = ['GET', 'POST'])
 def web_front():
     test_suite = load_tests()

mercurial