Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexandre Bulté
validata-ui
Commits
ce6ccb1b
Commit
ce6ccb1b
authored
Dec 03, 2018
by
Pierre Dittgen
Browse files
Better error display on source error
parent
ae4b0349
Changes
1
Hide whitespace changes
Inline
Side-by-side
validata_ui/views.py
View file @
ce6ccb1b
...
@@ -8,7 +8,6 @@ import json
...
@@ -8,7 +8,6 @@ import json
import
logging
import
logging
import
subprocess
import
subprocess
import
tempfile
import
tempfile
import
time
from
datetime
import
datetime
from
datetime
import
datetime
from
io
import
BytesIO
from
io
import
BytesIO
from
operator
import
itemgetter
from
operator
import
itemgetter
...
@@ -220,6 +219,15 @@ def validate(schema_code, source: ValidataSource):
...
@@ -220,6 +219,15 @@ def validate(schema_code, source: ValidataSource):
flash_error
(
'Erreur : format de fichier non supporté'
)
flash_error
(
'Erreur : format de fichier non supporté'
)
return
redirect
(
url_for
(
'scdl_validator'
,
val_code
=
schema_code
))
return
redirect
(
url_for
(
'scdl_validator'
,
val_code
=
schema_code
))
# source_errors = [err for err in validata_core_report['tables'][0]['errors'] if err['code'] == 'source-error']
source_errors
=
[
err
for
err
in
validata_core_report
[
'tables'
][
0
][
'errors'
]
if
err
[
'code'
]
==
'source-error'
]
if
source_errors
:
err
=
source_errors
[
0
]
msg
=
"l'encodage du fichier est invalide. Veuillez le corriger"
if
'charmap'
in
err
[
'message'
]
else
err
[
'message'
]
flash_error
(
'Erreur de source : {}'
.
format
(
msg
))
return
redirect
(
url_for
(
'scdl_validator'
,
val_code
=
schema_code
))
source_data
=
extract_source_data
(
source
)
source_data
=
extract_source_data
(
source
)
# handle report date
# handle report date
...
...
Write
Preview
Supports
Markdown
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