diff --git a/trans.py b/trans.py index 80b18f3b60983d4471efac8a7488aabb8ad1dbc0..cc35244dfa2b3948198c97822e2cae2cf1e0fc24 100644 --- a/trans.py +++ b/trans.py @@ -18,9 +18,13 @@ def cert_to_xml(cert_doc): 'name':[{'content':[config['name']],'lang':'en'}], \ 'release':version \ } - cert_doc['DCC']['administrativeData']['dccSoftware'].append(s) - xml = prettify_xml(render_template(dcc_template, doc=cert_doc['DCC']), \ - indent=2, debug=False) + cert_doc['DCC']['administrativeData']['dccSoftware'].append(s) + + xml = render_template(dcc_template, doc=cert_doc['DCC']) + try: + xml = prettify_xml(xml, indent=2, debug=False) + except Exception as error: + xml = '<error>' + str(error) + '</error>\n' return xml