empty test error fixed
diff --git a/web_app/__init__.py b/web_app/__init__.py
index dffc1a1..7e6edf9 100644
--- a/web_app/__init__.py
+++ b/web_app/__init__.py
@@ -24,10 +24,10 @@
with open(TEST_PATH + "/" + test_name, 'rt') as f:
raw = f.read()
- if raw == '':
- raise Exception("Test is empty")
-
- test = json.loads(raw)
+ if raw != "":
+ test = json.loads(raw)
+ else:
+ test = []
return test
@@ -48,25 +48,25 @@
def render_test(test_name):
tests = load_test(test_name)
header_keys = ['build_id', 'iso_md5', 'type']
- table = []
+ table = [[]]
if len(tests) > 0:
sorted_keys = sorted(tests[0].keys())
- for key in sorted_keys:
- if key not in header_keys:
- header_keys.append(key)
+ for key in sorted_keys:
+ if key not in header_keys:
+ header_keys.append(key)
- for test in tests:
- row = []
+ for test in tests:
+ row = []
- for header in header_keys:
- if isinstance(test[header], list):
- row.append(str(test[header][0]) + unichr(0x00B1) + str(test[header][1]))
- else:
- row.append(test[header])
+ for header in header_keys:
+ if isinstance(test[header], list):
+ row.append(str(test[header][0]) + unichr(0x00B1) + str(test[header][1]))
+ else:
+ row.append(test[header])
- table.append(row)
+ table.append(row)
return render_template("table.html", headers=header_keys, table=table)