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-ui
Commits
38c32193
Commit
38c32193
authored
Jun 19, 2019
by
Christophe Benz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging in app initialization
parent
ce779265
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
validata_ui/__init__.py
validata_ui/__init__.py
+5
-3
No files found.
validata_ui/__init__.py
View file @
38c32193
...
...
@@ -4,12 +4,12 @@ import os
from
pathlib
import
Path
from
urllib.parse
import
quote_plus
import
cachecontrol
import
flask
import
jinja2
import
requests
import
tableschema
import
cachecontrol
import
opendataschema
from
.
import
config
...
...
@@ -29,17 +29,19 @@ def generate_schema_from_url_func(session):
return
schema_from_url
# And load schema catalogs which
url
s are found in config.json
# And load schema catalogs which
URL
s are found in
homepage_
config.json
schema_catalog_map
=
{}
if
config
.
HOMEPAGE_CONFIG
:
log
.
info
(
"Initializing homepage sections..."
)
caching_session
=
cachecontrol
.
CacheControl
(
requests
.
Session
())
schema_from_url
=
generate_schema_from_url_func
(
caching_session
)
for
section
in
config
.
HOMEPAGE_CONFIG
[
'sections'
]:
if
isinstance
(
section
[
'catalog'
],
str
)
and
section
[
'catalog'
].
startswith
(
'http'
):
code
=
section
[
'code'
]
log
.
info
(
'Initializing homepage section "{}"...'
.
format
(
code
))
if
isinstance
(
section
[
'catalog'
],
str
)
and
section
[
'catalog'
].
startswith
(
'http'
):
url
=
section
[
'catalog'
]
schema_catalog_map
[
code
]
=
opendataschema
.
SchemaCatalog
(
url
,
session
=
caching_session
)
log
.
info
(
"...done"
)
# Flask things
app
=
flask
.
Flask
(
__name__
)
...
...
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