webfront.py

changeset 61
15c95d3fcfd8
parent 57
c147116768f4
child 62
f0a6bf48b05e
--- 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>')

mercurial