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
eccdd4f1
Commit
eccdd4f1
authored
Jul 31, 2019
by
Pierre Dittgen
Browse files
Home page: deal with non existent repo
parent
79aa5de9
Changes
2
Hide whitespace changes
Inline
Side-by-side
validata_ui/templates/home.html
View file @
eccdd4f1
...
...
@@ -17,7 +17,8 @@
<select
required
name=
"schema_name"
class=
"form-control"
>
<option
disabled
selected
value=
""
>
Choisissez un schéma
</option>
{% for item in section.catalog %}
<option
value=
"{{ section.name }}.{{ item.name }}"
>
{{ item.title }}
</option>
<option
{%
if
item.err
%}
disabled
{%
endif
%}
value=
"{{ section.name }}.{{ item.name }}"
>
{{ item.title }}
</option>
{% endfor %}
</select>
</div>
...
...
validata_ui/views.py
View file @
eccdd4f1
...
...
@@ -461,11 +461,17 @@ def home():
home_section_catalog
=
[]
for
schema_reference
in
schema_catalog
.
references
:
# Loads default table schema for each schema reference
table_schema
=
tableschema_from_url
(
schema_reference
.
get_schema_url
())
home_section_catalog
.
append
({
"name"
:
schema_reference
.
name
,
"title"
:
table_schema
.
descriptor
.
get
(
"title"
)
or
schema_reference
.
name
,
})
schema_info
=
{
'name'
:
schema_reference
.
name
}
try
:
table_schema
=
tableschema_from_url
(
schema_reference
.
get_schema_url
())
except
:
schema_info
[
'err'
]
=
True
schema_info
[
'title'
]
=
'Schéma "{}" non disponible'
.
format
(
schema_reference
.
name
)
else
:
schema_info
[
'title'
]
=
table_schema
.
descriptor
.
get
(
"title"
)
or
schema_reference
.
name
home_section_catalog
.
append
(
schema_info
)
home_section
[
'catalog'
]
=
sorted
(
home_section_catalog
,
key
=
lambda
sc
:
strip_accents
(
sc
[
'title'
].
lower
()))
...
...
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