|
|
|
|
@ -2,9 +2,9 @@ import os
|
|
|
|
|
import re
|
|
|
|
|
import typing as t
|
|
|
|
|
|
|
|
|
|
from peewee import *
|
|
|
|
|
from lxml import etree
|
|
|
|
|
from flask import Blueprint, abort, render_template, request, send_from_directory
|
|
|
|
|
from playhouse.flask_utils import PaginatedQuery
|
|
|
|
|
from peewee import *
|
|
|
|
|
|
|
|
|
|
from .app import APPPATH
|
|
|
|
|
from .modeles import Institution, State, House, Intervention_type, Production_place, Diplo_type, Document, Acte, Individual, Involved_in
|
|
|
|
|
@ -78,9 +78,24 @@ def acte(house=None, prince=None, acte_id=None):
|
|
|
|
|
Diplo_type.id_diplo_type == acte_diplo_type)]
|
|
|
|
|
state = [t.state_label for t in State.select().where(
|
|
|
|
|
State.id_state == acte_state_id)]
|
|
|
|
|
|
|
|
|
|
source_doc = etree.parse(
|
|
|
|
|
os.path.join(APPPATH, "static", "xml", house, acte_id + '.xml'))
|
|
|
|
|
# remove namespace :
|
|
|
|
|
query = "descendant-or-self::*[namespace-uri()!='']"
|
|
|
|
|
for element in source_doc.xpath(query):
|
|
|
|
|
#replace element name with its local name
|
|
|
|
|
element.tag = etree.QName(element).localname
|
|
|
|
|
etree.cleanup_namespaces(source_doc)
|
|
|
|
|
|
|
|
|
|
xslt_doc = etree.parse(os.path.join(APPPATH, "static", "xsl", "actes_princiers.xsl"))
|
|
|
|
|
xslt_transformer = etree.XSLT(xslt_doc)
|
|
|
|
|
output_doc = xslt_transformer(source_doc)
|
|
|
|
|
print(output_doc)
|
|
|
|
|
return render_template("acte.html", house=house, prince=prince,
|
|
|
|
|
infos=q_acte, place=place[0], doc=doc[0][0], arch=inst[0],
|
|
|
|
|
diplo=diplo_t[0].replace("_", " "), state=state[0])
|
|
|
|
|
diplo=diplo_t[0].replace("_", " "), state=state[0],
|
|
|
|
|
output_doc=output_doc)
|
|
|
|
|
|
|
|
|
|
@main.route("/contact")
|
|
|
|
|
def contact() -> t.Text:
|
|
|
|
|
|