Skip to content
Snippets Groups Projects
Commit 4a245b0b authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

"canonicalize(...)" added

parent 1f4380a6
Branches
Tags 0.1.37
No related merge requests found
...@@ -148,7 +148,11 @@ setup( ...@@ -148,7 +148,11 @@ setup(
# #
# For an analysis of "install_requires" vs pip's requirements files see: # For an analysis of "install_requires" vs pip's requirements files see:
# https://packaging.python.org/en/latest/requirements.html # https://packaging.python.org/en/latest/requirements.html
install_requires=['peppercorn'], # Optional install_requires=[
'lxml',
'prettierfier',
'flask'
], # Optional
# List additional groups of dependencies here (e.g. development # List additional groups of dependencies here (e.g. development
# dependencies). Users will be able to install these using the "extras" # dependencies). Users will be able to install these using the "extras"
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
{%- for j in i['description'] %} {%- for j in i['description'] %}
<dcc:content lang="{{j.lang}}"> <dcc:content lang="{{j.lang}}">
{%- for k in j.content %} {%- for k in j.content %}
{{utils.sanitize_ltx(k)|safe}} {{k|safe}}
{% endfor -%} {% endfor -%}
</dcc:content> </dcc:content>
{% endfor -%} {% endfor -%}
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
{%- for j in i['description'] %} {%- for j in i['description'] %}
<dcc:content lang="{{j.lang}}"> <dcc:content lang="{{j.lang}}">
{%- for k in j.content %} {%- for k in j.content %}
{{utils.sanitize_ltx(k)|safe}} {{k|safe}}
{% endfor -%} {% endfor -%}
</dcc:content> </dcc:content>
{% endfor -%} {% endfor -%}
......
...@@ -2,6 +2,7 @@ from flask import Flask, render_template ...@@ -2,6 +2,7 @@ from flask import Flask, render_template
import utils as utils import utils as utils
import os import os
from lxml import etree
from prettierfier import prettify_xml from prettierfier import prettify_xml
config = utils.config config = utils.config
...@@ -22,7 +23,7 @@ def cert_to_xml(cert_doc): ...@@ -22,7 +23,7 @@ def cert_to_xml(cert_doc):
xml = render_template(dcc_template, doc=cert_doc['DCC'], utils=utils) xml = render_template(dcc_template, doc=cert_doc['DCC'], utils=utils)
try: try:
xml = prettify_xml(xml, indent=2, debug=False) xml = etree.canonicalize(prettify_xml(xml, indent=2, debug=False))
except Exception as error: except Exception as error:
xml = '<error>' + str(error) + '</error>\n' xml = '<error>' + str(error) + '</error>\n'
......
...@@ -68,7 +68,7 @@ ltx2entity = { ...@@ -68,7 +68,7 @@ ltx2entity = {
'>':'&gt;' '>':'&gt;'
} }
def sanitize_ltx(x): def sanitize_ltx(x):# unnecessary, as done by canonicalize
for key in ltx2entity: for key in ltx2entity:
x = x.replace(key, ltx2entity[key]) x = x.replace(key, ltx2entity[key])
return x return x
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment