Handle missing institution labels.

This commit is contained in:
Edward Betts 2020-03-04 09:05:35 +00:00
parent 3e551d89d9
commit 3999817cc9

4
app.py
View file

@ -349,11 +349,11 @@ def get_institution(entity, other):
if 'P276' in entity['claims']: if 'P276' in entity['claims']:
location = wikibase.first_datavalue(entity, 'P276') location = wikibase.first_datavalue(entity, 'P276')
if location: if location:
return other[location['id']] return other.get(location['id'])
if 'P195' in entity['claims']: if 'P195' in entity['claims']:
collection = wikibase.first_datavalue(entity, 'P195') collection = wikibase.first_datavalue(entity, 'P195')
if collection: if collection:
return other[collection['id']] return other.get(collection['id'])
@app.route("/item/Q<int:item_id>") @app.route("/item/Q<int:item_id>")
def item_page(item_id): def item_page(item_id):