forked from ScoDoc/ScoDoc
misc fixes
This commit is contained in:
parent
1af9fb2410
commit
76b533729f
@ -585,7 +585,7 @@ class GenTable(object):
|
||||
v = ""
|
||||
x_cell = ElementTree.Element(cid, value=str(v))
|
||||
x_row.append(x_cell)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
def json(self):
|
||||
"""JSON representation of the table."""
|
||||
|
@ -437,4 +437,4 @@ def make_xml_formsemestre_bulletinetud(
|
||||
if is_appending:
|
||||
return None
|
||||
else:
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
@ -503,7 +503,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG
|
||||
)
|
||||
)
|
||||
log("XMLgetGroupsInPartition: %s seconds" % (time.time() - t0))
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
|
||||
def comp_origin(etud, cur_sem):
|
||||
|
@ -671,7 +671,7 @@ def _add_moymod_column(
|
||||
) # note sur 20, ou 'NA','NI'
|
||||
row[col_id] = scu.fmt_note(val, keep_numeric=keep_numeric)
|
||||
row["_" + col_id + "_td_attrs"] = ' class="moyenne" '
|
||||
if isinstance(val, str):
|
||||
if not isinstance(val, str):
|
||||
notes.append(val)
|
||||
nb_notes = nb_notes + 1
|
||||
sum_notes += val
|
||||
|
@ -905,7 +905,11 @@ def _formsemestre_recapcomplet_xml(
|
||||
xml_nodate=xml_nodate,
|
||||
xml_with_decisions=xml_with_decisions,
|
||||
)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc), "", "xml"
|
||||
return (
|
||||
sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING),
|
||||
"",
|
||||
"xml",
|
||||
)
|
||||
|
||||
|
||||
def _formsemestre_recapcomplet_json(
|
||||
|
@ -562,7 +562,7 @@ def sendXML(REQUEST, data, tagname=None, force_outer_xml_tag=True):
|
||||
|
||||
if REQUEST:
|
||||
REQUEST.RESPONSE.setHeader("content-type", XML_MIMETYPE)
|
||||
return repr(doc)
|
||||
return doc
|
||||
|
||||
|
||||
def sendResult(REQUEST, data, name=None, format=None, force_outer_xml_tag=True):
|
||||
@ -823,7 +823,7 @@ def _sco_error_response(context, msg, format="html", REQUEST=None):
|
||||
elif format == "xml":
|
||||
REQUEST.RESPONSE.setHeader("content-type", XML_MIMETYPE)
|
||||
doc = ElementTree.Element("error", msg=msg)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
elif format == "json":
|
||||
REQUEST.RESPONSE.setHeader("content-type", JSON_MIMETYPE)
|
||||
return "undefined" # XXX voir quoi faire en cas d'erreur json
|
||||
|
@ -32,9 +32,10 @@
|
||||
from xml.etree import ElementTree
|
||||
import xml.sax.saxutils
|
||||
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||
|
||||
XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>\n"""
|
||||
XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>"""
|
||||
|
||||
|
||||
def quote_xml_attr(data):
|
||||
@ -63,7 +64,9 @@ def simple_dictlist2xml(dictlist, doc=None, tagname=None, quote=False):
|
||||
if not tagname:
|
||||
raise ValueError("invalid empty tagname !")
|
||||
elements = _dictlist2xml(dictlist, root=[], tagname=tagname, quote=quote)
|
||||
return XML_HEADER + "\n".join([ElementTree.tostring(x) for x in elements])
|
||||
return XML_HEADER + b"\n".join([ElementTree.tostring(x) for x in elements]).decode(
|
||||
scu.SCO_ENCODING
|
||||
)
|
||||
|
||||
|
||||
def _dictlist2xml(dictlist, root=None, tagname=None, quote=False):
|
||||
|
@ -1534,7 +1534,7 @@ def XMLgetAbsEtud(context, beg_date="", end_date="", REQUEST=None):
|
||||
)
|
||||
)
|
||||
log("XMLgetAbsEtud (%gs)" % (time.time() - t0))
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
|
||||
context.populate(globals())
|
||||
|
@ -239,11 +239,13 @@ sco_publish(
|
||||
"/formsemestre_clone",
|
||||
sco_formsemestre_edit.formsemestre_clone,
|
||||
Permission.ScoImplement,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_associate_new_version",
|
||||
sco_formsemestre_edit.formsemestre_associate_new_version,
|
||||
Permission.ScoChangeFormation,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_delete",
|
||||
@ -655,7 +657,7 @@ def XMLgetFormsemestres(context, etape_apo=None, formsemestre_id=None, REQUEST=N
|
||||
for sem in sco_formsemestre.do_formsemestre_list(context, args=args):
|
||||
doc.append("formsemestre", **sem)
|
||||
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
|
||||
sco_publish(
|
||||
@ -673,6 +675,7 @@ sco_publish(
|
||||
"/formsemestre_change_lock",
|
||||
sco_formsemestre_edit.formsemestre_change_lock,
|
||||
Permission.ScoView,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_change_publication_bul",
|
||||
@ -721,7 +724,7 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
|
||||
userlist = sco_users.get_user_list()
|
||||
login2display = {} # user_name : forme pour affichage = "NOM Prenom (login)"
|
||||
for u in userlist:
|
||||
login2display[u["user_name"]] = u["nomplogin"]
|
||||
login2display[u.user_name] = u.get_nomplogin()
|
||||
allowed_user_names = list(login2display.values())
|
||||
|
||||
H = [
|
||||
@ -1446,6 +1449,7 @@ sco_publish(
|
||||
"/moduleimpl_inscriptions_edit",
|
||||
sco_moduleimpl_inscriptions.moduleimpl_inscriptions_edit,
|
||||
Permission.ScoEtudInscrit,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/moduleimpl_inscriptions_stats",
|
||||
|
@ -473,10 +473,10 @@ def get_user_list_xml(dept=None, start="", limit=25, REQUEST=None):
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
doc = ElementTree.Element("results")
|
||||
for user in userlist[:limit]:
|
||||
x_rs = ElementTree.Element("rs", id=user.id, info="")
|
||||
x_rs = ElementTree.Element("rs", id=str(user.id), info="")
|
||||
x_rs.text = user.get_nomplogin()
|
||||
doc.append(x_rs)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
|
||||
@bp.route("/form_change_password")
|
||||
|
Loading…
Reference in New Issue
Block a user