|
|
@@ -6,8 +6,8 @@ Python 3.7+
|
|
|
from datetime import datetime
|
|
|
import json
|
|
|
import logging
|
|
|
-import subprocess
|
|
|
-import tempfile
|
|
|
+import subprocess #@UnusedImport
|
|
|
+import tempfile #@UnusedImport
|
|
|
import zipfile
|
|
|
|
|
|
from jinja2.environment import Template
|
|
|
@@ -27,7 +27,6 @@ logger.disabled = True
|
|
|
|
|
|
# TODO: Vérifier la projection (besoin de GDAL/OGR)
|
|
|
# TODO: fonctions de controle spéciales
|
|
|
-# TODO: Rendu HTML
|
|
|
|
|
|
class ReportField():
|
|
|
def __init__(self, name, value = "", error=""):
|
|
|
@@ -296,26 +295,26 @@ def check_folder(folder, checker):
|
|
|
|
|
|
|
|
|
def render_to_html(report):
|
|
|
- with open(MAIN / "website" / "templates" / "report.j2", "r", encoding="utf-8") as f:
|
|
|
+ with open(MAIN / "templates" / "report.j2", "r") as f:
|
|
|
template = Template(f.read())
|
|
|
|
|
|
return template.render(report=report)
|
|
|
|
|
|
|
|
|
-if __name__ == "__main__":
|
|
|
-
|
|
|
- subject = MAIN / "work" / "SCOPELEC_CAP_097AP0_REC_180829_OK.zip"
|
|
|
- checker = MAIN / "resources" / "netgeo_v2-2_doe.yaml"
|
|
|
-
|
|
|
- report = check(subject, checker)
|
|
|
-
|
|
|
- result = render_to_html(report)
|
|
|
-
|
|
|
- result_filename = tempfile.mktemp(".html", dir=MAIN / "website")
|
|
|
-
|
|
|
- with open(result_filename, "w+") as f:
|
|
|
- f.write(result)
|
|
|
-
|
|
|
- subprocess.run("start {}".format(result_filename), shell=True)
|
|
|
-
|
|
|
- logger.info("-- Fin --")
|
|
|
+# if __name__ == "__main__":
|
|
|
+#
|
|
|
+# subject = MAIN / "work" / "SCOPELEC_CAP_097AP0_REC_180829_OK.zip"
|
|
|
+# checker = MAIN / "resources" / "netgeo_v2-2_doe.yaml"
|
|
|
+#
|
|
|
+# report = check(subject, checker)
|
|
|
+#
|
|
|
+# result = render_to_html(report)
|
|
|
+#
|
|
|
+# result_filename = tempfile.mktemp(".html", dir=MAIN / "website")
|
|
|
+#
|
|
|
+# with open(result_filename, "w+") as f:
|
|
|
+# f.write(result)
|
|
|
+#
|
|
|
+# subprocess.run("start {}".format(result_filename), shell=True)
|
|
|
+#
|
|
|
+# logger.info("-- Fin --")
|