Commit 9bef58fd authored by Pierre Dittgen's avatar Pierre Dittgen

Fix crash

parent 43a65e68
......@@ -229,16 +229,17 @@ def repair_core(dataset: tablib.Dataset, schema_field_names):
for col_id in empty_header_cols])
# Compare ordering
schema_order_extract = [h for h in schema_field_names if h in content_dataset.headers]
if content_dataset.headers != schema_order_extract:
report.append(goodtables.Error(code='wrong-headers-order',
message_substitutions={'actual-order': content_dataset.headers,
'wanted-order': schema_order_extract}))
if content_dataset.headers:
schema_order_extract = [h for h in schema_field_names if h in content_dataset.headers]
if content_dataset.headers != schema_order_extract:
report.append(goodtables.Error(code='wrong-headers-order',
message_substitutions={'actual-order': content_dataset.headers,
'wanted-order': schema_order_extract}))
# Then reorder and create empty columns if no content found
fixed_dataset = tablib.Dataset()
for h in schema_field_names:
if h in content_dataset.headers:
if content_dataset.headers and h in content_dataset.headers:
col_id = content_dataset.headers.index(h)
append_col(fixed_dataset, content_dataset.get_col(col_id), h)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment