Commit eccdd4f1 authored by Pierre Dittgen's avatar Pierre Dittgen

Home page: deal with non existent repo

parent 79aa5de9
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
<select required name="schema_name" class="form-control"> <select required name="schema_name" class="form-control">
<option disabled selected value="">Choisissez un schéma</option> <option disabled selected value="">Choisissez un schéma</option>
{% for item in section.catalog %} {% 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 %} {% endfor %}
</select> </select>
</div> </div>
......
...@@ -461,11 +461,17 @@ def home(): ...@@ -461,11 +461,17 @@ def home():
home_section_catalog = [] home_section_catalog = []
for schema_reference in schema_catalog.references: for schema_reference in schema_catalog.references:
# Loads default table schema for each schema reference # Loads default table schema for each schema reference
table_schema = tableschema_from_url(schema_reference.get_schema_url()) schema_info = {
home_section_catalog.append({ 'name': schema_reference.name
"name": schema_reference.name, }
"title": table_schema.descriptor.get("title") or 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'] = sorted(
home_section_catalog, key=lambda sc: strip_accents(sc['title'].lower())) home_section_catalog, key=lambda sc: strip_accents(sc['title'].lower()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment