Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Validata
Validata Core
Commits
9bef58fd
Commit
9bef58fd
authored
Jul 26, 2019
by
Pierre Dittgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash
parent
43a65e68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
validata_core/__init__.py
validata_core/__init__.py
+7
-6
No files found.
validata_core/__init__.py
View file @
9bef58fd
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment