1
0
forked from ScoDoc/ScoDoc

xml without jaxml

This commit is contained in:
Emmanuel Viennet 2021-07-10 17:40:40 +02:00
parent ec8bef7984
commit 9d6e882199
3 changed files with 28 additions and 23 deletions

View File

@ -106,8 +106,10 @@ def make_xml_formsemestre_bulletinetud(
x = Element("bulletinetud", **el)
if doc:
is_appending = True
doc.append(x)
else:
is_appending = False
doc = x
# Infos sur l'etudiant
etudinfo = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
@ -424,12 +426,15 @@ def make_xml_formsemestre_bulletinetud(
apprecs = sco_etud.appreciations_list(
cnx, args={"etudid": etudid, "formsemestre_id": formsemestre_id}
)
for app in apprecs:
doc.append(
Element(
"appreciation",
scu.quote_xml_attr(app["comment"]),
date=ndb.DateDMYtoISO(app["date"]),
)
for appr in apprecs:
x_appr = Element(
"appreciation",
date=ndb.DateDMYtoISO(appr["date"]),
)
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
x_appr.text = scu.quote_xml_attr(appr["comment"])
doc.append(x_appr)
if is_appending:
return None
else:
return sco_xml.XML_HEADER + ElementTree.tostring(doc)

View File

@ -43,7 +43,6 @@ import xml.dom.minidom
from xml.etree import ElementTree
from xml.etree.ElementTree import Element
import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log

View File

@ -29,7 +29,7 @@
"""
import time
import datetime
import jaxml
from xml.etree import ElementTree
import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log
@ -50,6 +50,7 @@ from app.scodoc import sco_permissions_check
from app.scodoc import sco_preferences
from app.scodoc import sco_etud
from app.scodoc import sco_users
from app.scodoc import sco_xml
from app.scodoc.sco_codes_parcours import DEF, UE_SPORT
@ -876,24 +877,25 @@ def _formsemestre_recapcomplet_xml(
if not T:
return "", "", "xml"
doc = jaxml.XML_document(encoding=scu.SCO_ENCODING)
if xml_nodate:
docdate = ""
else:
docdate = datetime.datetime.now().isoformat()
doc.recapsemestre(formsemestre_id=formsemestre_id, date=docdate)
evals = sco_evaluations.do_evaluation_etat_in_sem(context, formsemestre_id)
doc._push()
doc.evals_info(
nb_evals_completes=evals["nb_evals_completes"],
nb_evals_en_cours=evals["nb_evals_en_cours"],
nb_evals_vides=evals["nb_evals_vides"],
date_derniere_note=evals["last_modif"],
doc = ElementTree.Element(
"recapsemestre", formsemestre_id=formsemestre_id, date=docdate
)
evals = sco_evaluations.do_evaluation_etat_in_sem(context, formsemestre_id)
doc.append(
ElementTree.Element(
"evals_info",
nb_evals_completes=str(evals["nb_evals_completes"]),
nb_evals_en_cours=str(evals["nb_evals_en_cours"]),
nb_evals_vides=str(evals["nb_evals_vides"]),
date_derniere_note=str(evals["last_modif"]),
)
)
doc._pop()
for t in T:
etudid = t[-1]
doc._push()
sco_bulletins_xml.make_xml_formsemestre_bulletinetud(
context,
formsemestre_id,
@ -903,8 +905,7 @@ def _formsemestre_recapcomplet_xml(
xml_nodate=xml_nodate,
xml_with_decisions=xml_with_decisions,
)
doc._pop()
return repr(doc), "", "xml"
return sco_xml.XML_HEADER + ElementTree.tostring(doc), "", "xml"
def _formsemestre_recapcomplet_json(