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
Validata
Validata UI
Commits
1410a3d5
Commit
1410a3d5
authored
Nov 29, 2018
by
Christophe Benz
Browse files
Display validation date in user locale
parent
d5ce0e7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
setup.py
View file @
1410a3d5
...
...
@@ -23,6 +23,8 @@ setup(
packages
=
[
'validata_ui'
],
include_package_data
=
True
,
install_requires
=
[
'backports-datetime-fromisoformat'
,
'commonmark'
,
'ezodf'
,
'flask'
,
...
...
validata_ui/views.py
View file @
1410a3d5
...
...
@@ -13,6 +13,7 @@ from operator import itemgetter
from
pathlib
import
Path
from
urllib.parse
import
quote_plus
from
backports.datetime_fromisoformat
import
MonkeyPatch
from
commonmark
import
commonmark
from
flask
import
make_response
,
redirect
,
render_template
,
request
,
url_for
...
...
@@ -24,6 +25,8 @@ from validata_ui.ui_util import flash_error, flash_warning
from
validata_ui.validata_util
import
ValidataSource
from
validata_ui.validate_helper
import
ValidatorHelper
MonkeyPatch
.
patch_fromisoformat
()
def
extract_source_data
(
source
:
ValidataSource
,
preview_rows_nb
=
5
):
""" Computes table preview """
...
...
@@ -216,8 +219,7 @@ def validate(schema_code, source: ValidataSource):
source_data
=
extract_source_data
(
source
)
# handle report date
date_str
=
validata_core_report
[
'date'
]
report_date
=
datetime
.
strptime
(
date_str
[:
date_str
.
find
(
'.'
)],
'%Y-%m-%dT%H:%M:%S'
)
report_datetime
=
datetime
.
fromisoformat
(
validata_core_report
[
'date'
]).
astimezone
()
# Enhance validata_core_report
validata_report
=
create_validata_ui_report
(
validata_core_report
,
ValidatorHelper
.
schema
(
schema_code
).
descriptor
)
...
...
@@ -226,7 +228,7 @@ def validate(schema_code, source: ValidataSource):
val_info
=
ValidatorHelper
.
schema_info
(
schema_code
)
return
render_template
(
'validation_report.html'
,
title
=
'Rapport de validation'
,
val_info
=
ValidatorHelper
.
schema_info
(
schema_code
),
report
=
validata_report
,
validation_date
=
report_date
.
strftime
(
'le %d/%m/%Y à %Hh%M'
),
validation_date
=
report_date
time
.
strftime
(
'le %d/%m/%Y à %Hh%M'
),
source
=
source
,
source_type
=
source
.
type
,
source_data
=
source_data
,
print_mode
=
request
.
args
.
get
(
'print'
,
'false'
)
==
'true'
,
report_str
=
json
.
dumps
(
validata_report
,
sort_keys
=
True
,
indent
=
2
),
...
...
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