Skip to content

Commit 9c090df

Browse files
authored
Handle blank lists (#15)
1 parent c624563 commit 9c090df

5 files changed

Lines changed: 471 additions & 1 deletion

File tree

src/eml2csv/lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ def _get_candidate_info(candidates_eml: XmlElement):
325325
if aff_identifier is None:
326326
raise ValueError("Affiliation without identifier in candidate list!")
327327
aff_identifier_id = _get_mandatory_attrib(aff_identifier, "Id")
328-
name = _get_mandatory_text(aff_identifier.find("./eml:RegisteredName", namespaces=NS))
328+
name = _get_text(aff_identifier.find("./eml:RegisteredName", namespaces=NS))
329+
name = "" if name is None else name
329330
aff_key = _AffiliationIdentifier(aff_identifier_id, name)
330331

331332
for cand in aff.findall("./eml:Candidate", namespaces=NS):

tests/Kandidatenlijsten_GR2022_Groningen.eml.xml

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

tests/Telling_GR2022_Groningen.eml.xml

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)