Commit 958b631f authored by Yohan Boniface's avatar Yohan Boniface

Catch invalid Intercarif XML

parent 59bbf26b
......@@ -2,7 +2,7 @@ ssh_key_urls:
ybon: http://nuage.yohanboniface.me/id_rsa.pub
regisb: http://minutebutterfly.com/id_rsa.pub
prod:
version: 0.3.0
version: 0.3.1
username: yboniface
hostname: 167.114.237.170
qa:
......
......@@ -16,7 +16,7 @@ def is_pkg(line):
with open('requirements.txt', encoding='utf-8') as reqs:
install_requires = [l for l in reqs.read().split('\n') if is_pkg(l)]
VERSION = (0, 3, 0)
VERSION = (0, 3, 1)
__author__ = 'Yohan Boniface'
__contact__ = "yohan.boniface@data.gouv.fr"
......
......@@ -117,7 +117,10 @@ async def populate_formation_from_bytes(context, content):
# Doc for leoh: http://lheo.gouv.fr/langage
# TODO: deal with action or session optional ids.
content = content.replace(b' xmlns="http://www.lheo.org/2.2"', b'')
tree = etree.fromstring(content)
try:
tree = etree.fromstring(content)
except etree.XMLSyntaxError:
raise UpstreamError('UPSTREAM_ERROR: Invalid INTERCARIF XML')
root = tree.find('offres/formation')
if root is None:
raise ValueError('No formation found')
......
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