Skip to content

Commit 8f73dca

Browse files
committed
Fix all potential KeyErrors @make_xml_codelist
1 parent cc57c75 commit 8f73dca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

prefix_finder/frontend/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,15 @@ def make_xml_codelist(use_branch="master"):
551551
items = ET.SubElement(root, "codelist-items")
552552

553553
for entry in org_id_dict[use_branch].values():
554-
if entry['access'] and entry['access'].get('availableOnline'):
554+
if entry.get('access') and entry['access'].get('availableOnline'):
555555
publicdb = str(1)
556556
else:
557557
publicdb = str(0)
558558

559-
if entry['deprecated']:
559+
if entry.get('deprecated'):
560560
status = 'withdrawn'
561561
else:
562-
if entry['confirmed']:
562+
if entry.get('confirmed'):
563563
status = 'active'
564564
else:
565565
status = 'draft'
@@ -572,7 +572,7 @@ def make_xml_codelist(use_branch="master"):
572572

573573
description = ET.SubElement(item, "description")
574574
ET.SubElement(description, "narrative").text = entry['description']['en']
575-
if entry['coverage']:
575+
if entry.get('coverage'):
576576
ET.SubElement(item, "category").text = entry['coverage'][0]
577577
else:
578578
ET.SubElement(item, "category").text = '-'

0 commit comments

Comments
 (0)