soften xml formation element

This commit is contained in:
Jean-Marie Place 2021-12-03 10:46:14 +01:00
parent d435f3b835
commit 0a000afba4

View File

@ -180,8 +180,14 @@ def formation_import_xml(doc: str, import_tags=True):
log("formation_import_xml: invalid XML data") log("formation_import_xml: invalid XML data")
raise ScoValueError("Fichier XML invalide") raise ScoValueError("Fichier XML invalide")
try:
f = dom.getElementsByTagName("formation")[0] # or dom.documentElement f = dom.getElementsByTagName("formation")[0] # or dom.documentElement
D = sco_xml.xml_to_dicts(f) D = sco_xml.xml_to_dicts(f)
except:
raise ScoValueError(
"Le document xml ne correspond pas à un programme BUT. (élément 'formation' inexistant "
"par exemple)."
)
assert D[0] == "formation" assert D[0] == "formation"
F = D[1] F = D[1]
# F_quoted = F.copy() # F_quoted = F.copy()