Commit eccdd4f1 authored by Pierre Dittgen's avatar Pierre Dittgen

Home page: deal with non existent repo

parent 79aa5de9
......@@ -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>
......
......@@ -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()))
......
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