Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
validata-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Validata
validata-ui
Commits
8034f2fb
Commit
8034f2fb
authored
Oct 03, 2018
by
Pierre Dittgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better format error handling
parent
756be367
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
39 deletions
+6
-39
validata_ui_next/views.py
validata_ui_next/views.py
+6
-39
No files found.
validata_ui_next/views.py
View file @
8034f2fb
...
...
@@ -54,43 +54,6 @@ def extract_source_data(source: ValidataSource, preview_rows_nb=5):
'preview_rows'
:
rows
[:
preview_rows_nb
]}
# ERR_CODE_TO_CONTEXT = dict([
# # TODO: gets it from spec.json
# ('duplicate-header', 'head'),
# ('extra-value', 'body'),
# ('missing-value', 'body'),
# ('source-error', 'table'),
# ('schema-error', 'table'),
# ('non-matching-header', 'head'),
# ('blank-row', 'body'),
# ('blank-header', 'head'),
# ('enumerable-constraint', 'body'),
# ('http-error', 'table'),
# ('scheme-error', 'table'),
# ('type-or-format-error', 'body'),
# ('format-error', 'table'),
# ('extra-header', 'head'),
# ('pattern-constraint', 'body'),
# ('required-constraint', 'body'),
# ('missing-header', 'head'),
# ('maximum-length-constraint', 'body'),
# ('maximum-constraint', 'body'),
# ('minimum-length-constraint', 'body'),
# ('encoding-error', 'table'),
# ('io-error', 'table'),
# ('unique-constraint', 'body'),
# ('duplicate-row', 'body'),
# ('minimum-constraint', 'body'),
# # TODO: get it from validata_validate
# ('invalid-column-delimiter', 'table'),
# ('missing-headers', 'table'),
# ('wrong-headers-order', 'table'),
# ('extra-headers', 'table'),
# # Custom checks fall in default case: body
# ])
ERROR_MESSAGE_FUNC
=
{
# Core checks
...
...
@@ -220,7 +183,11 @@ def create_validata_report(goodtables_report, schema):
def
validate
(
schema_code
,
source
:
ValidataSource
):
""" Validate source and display report """
goodtables_report
=
ValidatorHelper
.
validate
(
schema_code
,
**
source
.
get_goodtables_source
())
try
:
goodtables_report
=
ValidatorHelper
.
validate
(
schema_code
,
**
source
.
get_goodtables_source
())
except
tabulator
.
exceptions
.
FormatError
:
flash_error
(
'Erreur : format de fichier non supporté'
)
return
redirect
(
url_for
(
'scdl_validator'
,
val_code
=
schema_code
))
source_data
=
extract_source_data
(
source
)
...
...
@@ -299,7 +266,7 @@ def scdl_validator(val_code):
else
:
# POST
input_param
=
request
.
form
.
get
(
'input'
)
if
input_param
is
None
:
flash_error
(
'
Source non définie
'
)
flash_error
(
'
Aucun fichier à valider
'
)
return
redirect
(
url_for
(
'scdl_validator'
,
val_code
=
val_code
))
# File validation
...
...
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