From e918b5bcb4f3de9bb1dd062cc2211e3a76cfac30 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet
. HTML does not allow logos.
+ If fmt = 'html', replaces . HTML does not allow logos.
"""
try:
# None values are mapped to empty strings by WrapDict
@@ -225,7 +225,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"):
frag, _ = sco_bulletins.do_formsemestre_bulletinetud(
formsemestre,
etud,
- format="pdfpart",
+ fmt="pdfpart",
version=version,
)
fragments += frag
@@ -270,7 +270,7 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"):
frag, filigranne = sco_bulletins.do_formsemestre_bulletinetud(
formsemestre,
etud,
- format="pdfpart",
+ fmt="pdfpart",
version=version,
)
fragments += frag
diff --git a/app/scodoc/sco_bulletins_standard.py b/app/scodoc/sco_bulletins_standard.py
index e8dda75f08..ab49f8a8b1 100644
--- a/app/scodoc/sco_bulletins_standard.py
+++ b/app/scodoc/sco_bulletins_standard.py
@@ -116,7 +116,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
html_with_td_classes=True,
)
- return T.gen(format=fmt)
+ return T.gen(fmt=fmt)
def bul_part_below(self, fmt="html"):
"""Génère les informations placées sous la table de notes
diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py
index 3eafc5cabf..58305f1458 100644
--- a/app/scodoc/sco_bulletins_xml.py
+++ b/app/scodoc/sco_bulletins_xml.py
@@ -357,7 +357,7 @@ def make_xml_formsemestre_bulletinetud(
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
etudid,
formsemestre,
- format="xml",
+ fmt="xml",
show_uevalid=sco_preferences.get_preference(
"bul_show_uevalid", formsemestre_id
),
diff --git a/app/scodoc/sco_cost_formation.py b/app/scodoc/sco_cost_formation.py
index 87937b5e13..f266b0638e 100644
--- a/app/scodoc/sco_cost_formation.py
+++ b/app/scodoc/sco_cost_formation.py
@@ -152,7 +152,7 @@ def formsemestre_estim_cost(
n_group_tp=1,
coef_tp=1,
coef_cours=1.5,
- format="html",
+ fmt="html",
):
"""Page (formulaire) estimation coûts"""
@@ -192,4 +192,4 @@ def formsemestre_estim_cost(
coef_tp,
)
- return tab.make_page(format=format)
+ return tab.make_page(fmt=fmt)
diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py
index 09ae1f5a5b..c08a6e9995 100644
--- a/app/scodoc/sco_debouche.py
+++ b/app/scodoc/sco_debouche.py
@@ -49,7 +49,7 @@ from app.scodoc import sco_etud
import sco_version
-def report_debouche_date(start_year=None, format="html"):
+def report_debouche_date(start_year=None, fmt="html"):
"""Rapport (table) pour les débouchés des étudiants sortis
à partir de l'année indiquée.
"""
@@ -63,7 +63,7 @@ def report_debouche_date(start_year=None, format="html"):
"Année invalide. Année de début de la recherche"
)
- if format == "xls":
+ if fmt == "xls":
keep_numeric = True # pas de conversion des notes en strings
else:
keep_numeric = False
@@ -81,7 +81,7 @@ def report_debouche_date(start_year=None, format="html"):
title=""" fichier maquette CSV brut (non rempli par ScoDoc)
Débouchés étudiants
""",
init_qtip=True,
javascripts=["js/etud_info.js"],
- format=format,
+ fmt=fmt,
with_html_headers=True,
)
@@ -276,7 +276,7 @@ def itemsuivi_suppress(itemsuivi_id):
return ("", 204)
-def itemsuivi_create(etudid, item_date=None, situation="", format=None):
+def itemsuivi_create(etudid, item_date=None, situation="", fmt=None):
"""Creation d'un item"""
if not sco_permissions_check.can_edit_suivi():
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
@@ -287,7 +287,7 @@ def itemsuivi_create(etudid, item_date=None, situation="", format=None):
logdb(cnx, method="itemsuivi_create", etudid=etudid)
log("created itemsuivi %s for %s" % (itemsuivi_id, etudid))
item = itemsuivi_get(cnx, itemsuivi_id)
- if format == "json":
+ if fmt == "json":
return scu.sendJSON(item)
return item
@@ -320,13 +320,13 @@ def itemsuivi_set_situation(object, value):
return situation or scu.IT_SITUATION_MISSING_STR
-def itemsuivi_list_etud(etudid, format=None):
+def itemsuivi_list_etud(etudid, fmt=None):
"""Liste des items pour cet étudiant, avec tags"""
cnx = ndb.GetDBConnexion()
items = _itemsuivi_list(cnx, {"etudid": etudid})
for it in items:
it["tags"] = ", ".join(itemsuivi_tag_list(it["itemsuivi_id"]))
- if format == "json":
+ if fmt == "json":
return scu.sendJSON(items)
return items
diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py
index 39360d5f8a..80047fcd66 100644
--- a/app/scodoc/sco_edit_ue.py
+++ b/app/scodoc/sco_edit_ue.py
@@ -979,18 +979,18 @@ du programme" (menu "Semestre") si vous avez un semestre en cours);
Semestres courants de l'étape {etape_apo}
"""
@@ -575,7 +575,7 @@ def view_formsemestre_by_etape(etape_apo=None, format="html"):
""",
)
tab.base_url = "%s?etape_apo=%s" % (request.base_url, etape_apo or "")
- return tab.make_page(format=format)
+ return tab.make_page(fmt=fmt)
def sem_has_etape(sem, code_etape):
diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py
index 0f018d47b3..1b46a0484e 100755
--- a/app/scodoc/sco_formsemestre_status.py
+++ b/app/scodoc/sco_formsemestre_status.py
@@ -325,7 +325,7 @@ def formsemestre_status_menubar(formsemestre: FormSemestre) -> str:
"title": "Exporter table des étudiants",
"endpoint": "scolar.groups_view",
"args": {
- "format": "allxls",
+ "fmt": "allxls",
"group_ids": sco_groups.get_default_group(
formsemestre_id, fix_if_missing=True
),
@@ -787,7 +787,7 @@ def formsemestre_description_table(
def formsemestre_description(
- formsemestre_id, format="html", with_evals=False, with_parcours=False
+ formsemestre_id, fmt="html", with_evals=False, with_parcours=False
):
"""Description du semestre sous forme de table exportable
Liste des modules et de leurs coefficients
@@ -807,7 +807,7 @@ def formsemestre_description(
>indiquer les parcours BUT
"""
- return tab.make_page(format=format)
+ return tab.make_page(fmt=fmt)
# genere liste html pour accès aux groupes de ce semestre
diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py
index 8511ca692e..6a4d77e841 100644
--- a/app/scodoc/sco_groups.py
+++ b/app/scodoc/sco_groups.py
@@ -516,7 +516,7 @@ def get_etud_groups_in_partition(partition_id):
return R
-def formsemestre_partition_list(formsemestre_id, format="xml"):
+def formsemestre_partition_list(formsemestre_id, fmt="xml"):
"""Get partitions and groups in this semestre
Supported formats: xml, json
"""
@@ -524,7 +524,7 @@ def formsemestre_partition_list(formsemestre_id, format="xml"):
# Ajoute les groupes
for p in partitions:
p["group"] = get_partition_groups(p)
- return scu.sendResult(partitions, name="partition", format=format)
+ return scu.sendResult(partitions, name="partition", fmt=fmt)
# Encore utilisé par groupmgr.js
diff --git a/app/scodoc/sco_groups_exports.py b/app/scodoc/sco_groups_exports.py
index d6f63ea071..232f4cc3c6 100644
--- a/app/scodoc/sco_groups_exports.py
+++ b/app/scodoc/sco_groups_exports.py
@@ -60,7 +60,7 @@ def groups_list_annotation(group_ids: list[int]) -> list[dict]:
return annotations
-def groups_export_annotations(group_ids, formsemestre_id=None, format="html"):
+def groups_export_annotations(group_ids, formsemestre_id=None, fmt="html"):
"""Les annotations"""
groups_infos = sco_groups_view.DisplayedGroupsInfos(
group_ids, formsemestre_id=formsemestre_id
@@ -68,7 +68,7 @@ def groups_export_annotations(group_ids, formsemestre_id=None, format="html"):
annotations = groups_list_annotation(groups_infos.group_ids)
for annotation in annotations:
annotation["date_str"] = annotation["date"].strftime("%d/%m/%Y à %Hh%M")
- if format == "xls":
+ if fmt == "xls":
columns_ids = ("etudid", "nom", "prenom", "date", "comment")
else:
columns_ids = ("etudid", "nom", "prenom", "date_str", "comment")
@@ -93,4 +93,4 @@ def groups_export_annotations(group_ids, formsemestre_id=None, format="html"):
html_class="table_leftalign",
preferences=sco_preferences.SemPreferences(formsemestre_id),
)
- return table.make_page(format=format)
+ return table.make_page(fmt=fmt)
diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py
index 794c4ba3d3..835207735f 100644
--- a/app/scodoc/sco_groups_view.py
+++ b/app/scodoc/sco_groups_view.py
@@ -70,7 +70,7 @@ CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
# view:
def groups_view(
group_ids=(),
- format="html",
+ fmt="html",
# Options pour listes:
with_codes=0,
etat=None,
@@ -82,7 +82,7 @@ def groups_view(
):
"""Affichage des étudiants des groupes indiqués
group_ids: liste de group_id
- format: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf
+ fmt: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf
"""
# Informations sur les groupes à afficher:
groups_infos = DisplayedGroupsInfos(
@@ -92,10 +92,10 @@ def groups_view(
select_all_when_unspecified=True,
)
# Formats spéciaux: download direct
- if format != "html":
+ if fmt != "html":
return groups_table(
groups_infos=groups_infos,
- format=format,
+ fmt=fmt,
with_codes=with_codes,
etat=etat,
with_paiement=with_paiement,
@@ -135,7 +135,7 @@ def groups_view(
""",
groups_table(
groups_infos=groups_infos,
- format=format,
+ fmt=fmt,
with_codes=with_codes,
etat=etat,
with_paiement=with_paiement,
@@ -437,14 +437,14 @@ def groups_table(
groups_infos: DisplayedGroupsInfos = None,
with_codes=0,
etat=None,
- format="html",
+ fmt="html",
with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail)
with_archives=0, # ajoute colonne avec noms fichiers archivés
with_annotations=0,
with_bourse=0,
):
"""liste etudiants inscrits dans ce semestre
- format: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf
+ fmt: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf
Si with_codes, ajoute 4 colonnes avec les codes etudid, NIP, INE et etape
"""
from app.scodoc import sco_report
@@ -499,12 +499,12 @@ def groups_table(
p["partition_id"]: p["partition_name"] for p in groups_infos.partitions
}
- if format != "html": # ne mentionne l'état que en Excel (style en html)
+ if fmt != "html": # ne mentionne l'état que en Excel (style en html)
columns_ids.append("etat")
columns_ids.append("email")
columns_ids.append("emailperso")
- if format == "moodlecsv":
+ if fmt == "moodlecsv":
columns_ids = ["email", "semestre_groupe"]
if with_codes:
@@ -579,7 +579,7 @@ def groups_table(
else:
s = ""
- if format == "moodlecsv":
+ if fmt == "moodlecsv":
# de la forme S1-[FI][FA]-groupe.csv
if not moodle_groupenames:
moodle_groupenames = {"tous"}
@@ -612,7 +612,7 @@ def groups_table(
preferences=prefs,
)
#
- if format == "html":
+ if fmt == "html":
amail_inst = [
x["email"] for x in groups_infos.members if x["email"] and x["etat"] != "D"
]
@@ -683,11 +683,11 @@ def groups_table(
[
tab.html(),
"",
- '
Feuilles
",
'',
- """
Bordereau de Signatures (version PDF)',
+ f'
Bordereau de Signatures (version PDF)',
" \n",
@@ -670,7 +670,7 @@ def _add_eval_columns(
K,
note_sur_20,
keep_numeric,
- format="html",
+ fmt="html",
):
"""Add eval e"""
nb_notes = 0
@@ -774,7 +774,7 @@ def _add_eval_columns(
row_coefs[evaluation_id] = "coef. %s" % e["coefficient"]
if is_apc:
- if format == "html":
+ if fmt == "html":
row_poids[evaluation_id] = _mini_table_eval_ue_poids(
evaluation_id, evals_poids, ues
)
diff --git a/app/scodoc/sco_lycee.py b/app/scodoc/sco_lycee.py
index 4d9cf02fe3..d3585cd1cf 100644
--- a/app/scodoc/sco_lycee.py
+++ b/app/scodoc/sco_lycee.py
@@ -63,7 +63,7 @@ def formsemestre_table_etuds_lycees(
)
-def scodoc_table_etuds_lycees(format="html"):
+def scodoc_table_etuds_lycees(fmt="html"):
"""Table avec _tous_ les étudiants des semestres non verrouillés
de _tous_ les départements.
"""
@@ -71,7 +71,7 @@ def scodoc_table_etuds_lycees(format="html"):
semdepts = sco_formsemestre.scodoc_get_all_unlocked_sems()
etuds = []
try:
- for (sem, dept) in semdepts:
+ for sem, dept in semdepts:
app.set_sco_dept(dept.acronym)
etuds += sco_report.tsp_etud_list(sem["formsemestre_id"])[0]
finally:
@@ -85,8 +85,8 @@ def scodoc_table_etuds_lycees(format="html"):
no_links=True,
)
tab.base_url = request.base_url
- t = tab.make_page(format=format, with_html_headers=False)
- if format != "html":
+ t = tab.make_page(fmt=fmt, with_html_headers=False)
+ if fmt != "html":
return t
H = [
html_sco_header.sco_header(
@@ -178,7 +178,7 @@ def _table_etuds_lycees(etuds, group_lycees, title, preferences, no_links=False)
def formsemestre_etuds_lycees(
formsemestre_id,
- format="html",
+ fmt="html",
only_primo=False,
no_grouping=False,
):
@@ -191,14 +191,10 @@ def formsemestre_etuds_lycees(
tab.base_url += "&only_primo=1"
if no_grouping:
tab.base_url += "&no_grouping=1"
- t = tab.make_page(format=format, with_html_headers=False)
- if format != "html":
+ t = tab.make_page(fmt=fmt, with_html_headers=False)
+ if fmt != "html":
return t
- F = [
- sco_report.tsp_form_primo_group(
- only_primo, no_grouping, formsemestre_id, format
- )
- ]
+ F = [sco_report.tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, fmt)]
H = [
html_sco_header.sco_header(
page_title=tab.page_title,
diff --git a/app/scodoc/sco_placement.py b/app/scodoc/sco_placement.py
index 3bc9c2a619..d0cc4ca1b6 100644
--- a/app/scodoc/sco_placement.py
+++ b/app/scodoc/sco_placement.py
@@ -383,7 +383,7 @@ class PlacementRunner:
self.moduleimpl_data["formsemestre_id"]
),
)
- return tab.make_page(format="pdf", with_html_headers=False)
+ return tab.make_page(fmt="pdf", with_html_headers=False)
def _one_header(self, worksheet):
cells = [
diff --git a/app/scodoc/sco_poursuite_dut.py b/app/scodoc/sco_poursuite_dut.py
index 77c631e4ef..428f60aec6 100644
--- a/app/scodoc/sco_poursuite_dut.py
+++ b/app/scodoc/sco_poursuite_dut.py
@@ -178,7 +178,7 @@ def _getEtudInfoGroupes(group_ids, etat=None):
return etuds
-def formsemestre_poursuite_report(formsemestre_id, format="html"):
+def formsemestre_poursuite_report(formsemestre_id, fmt="html"):
"""Table avec informations "poursuite" """
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
etuds = _getEtudInfoGroupes([sco_groups.get_default_group(formsemestre_id)])
@@ -230,6 +230,6 @@ def formsemestre_poursuite_report(formsemestre_id, format="html"):
title="""Répartition des notes:
"
+ histo
+ "Poursuite d'études
""",
init_qtip=True,
javascripts=["js/etud_info.js"],
- format=format,
+ fmt=fmt,
with_html_headers=True,
)
diff --git a/app/scodoc/sco_pv_forms.py b/app/scodoc/sco_pv_forms.py
index 5b7be89e2b..014a84228f 100644
--- a/app/scodoc/sco_pv_forms.py
+++ b/app/scodoc/sco_pv_forms.py
@@ -206,14 +206,14 @@ def pvjury_table(
return lines, titles, columns_ids
-def formsemestre_pvjury(formsemestre_id, format="html", publish=True):
+def formsemestre_pvjury(formsemestre_id, fmt="html", publish=True):
"""Page récapitulant les décisions de jury
En classique: table spécifique avec les deux semestres pour le DUT
En APC/BUT: renvoie vers table recap, en mode jury.
"""
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
is_apc = formsemestre.formation.is_apc()
- if format == "html" and is_apc:
+ if fmt == "html" and is_apc:
return redirect(
url_for(
"notes.formsemestre_recapcomplet",
@@ -227,7 +227,7 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True):
dpv = sco_pv_dict.dict_pvjury(formsemestre_id, with_prev=True)
if not dpv:
- if format == "html":
+ if fmt == "html":
return (
html_sco_header.sco_header()
+ "Aucune information disponible !
"
@@ -239,7 +239,7 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True):
formsemestre_id = sem["formsemestre_id"]
rows, titles, columns_ids = pvjury_table(dpv)
- if format != "html" and format != "pdf":
+ if fmt != "html" and fmt != "pdf":
columns_ids = ["etudid", "code_nip"] + columns_ids
tab = GenTable(
@@ -255,9 +255,9 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True):
html_sortable=True,
preferences=sco_preferences.SemPreferences(formsemestre_id),
)
- if format != "html":
+ if fmt != "html":
return tab.make_page(
- format=format,
+ fmt=fmt,
with_html_headers=False,
publish=publish,
)
diff --git a/app/scodoc/sco_report.py b/app/scodoc/sco_report.py
index 70bc7afe5b..a558bce129 100644
--- a/app/scodoc/sco_report.py
+++ b/app/scodoc/sco_report.py
@@ -205,7 +205,7 @@ def _results_by_category(
bottom_titles["row_title"] = "Total"
# ajout titre ligne:
- for (cat, l) in zip(categories, C):
+ for cat, l in zip(categories, C):
l["row_title"] = cat if cat is not None else "?"
#
@@ -274,7 +274,7 @@ def formsemestre_report(
return tab
-# def formsemestre_report_bacs(formsemestre_id, format='html'):
+# def formsemestre_report_bacs(formsemestre_id, fmt='html'):
# """
# Tableau sur résultats par type de bac
# """
@@ -287,12 +287,12 @@ def formsemestre_report(
# title=title)
# return tab.make_page(
# title = """Résultats de %(titreannee)s
""" % sem,
-# format=format, page_title = title)
+# fmt=fmt, page_title = title)
def formsemestre_report_counts(
formsemestre_id: int,
- format="html",
+ fmt="html",
category: str = "bac",
result: str = None,
allkeys: bool = False,
@@ -397,10 +397,10 @@ def formsemestre_report_counts(
t = tab.make_page(
title="""Comptes croisés
""",
- format=format,
+ fmt=fmt,
with_html_headers=False,
)
- if format != "html":
+ if fmt != "html":
return t
H = [
html_sco_header.sco_header(page_title=title),
@@ -734,7 +734,7 @@ def table_suivi_cohorte(
def formsemestre_suivi_cohorte(
formsemestre_id,
- format="html",
+ fmt="html",
percent=1,
bac="",
bacspecialite="",
@@ -774,8 +774,8 @@ def formsemestre_suivi_cohorte(
)
if only_primo:
tab.base_url += "&only_primo=on"
- t = tab.make_page(format=format, with_html_headers=False)
- if format != "html":
+ t = tab.make_page(fmt=fmt, with_html_headers=False)
+ if fmt != "html":
return t
base_url = request.base_url
@@ -1246,7 +1246,7 @@ def table_suivi_cursus(formsemestre_id, only_primo=False, grouped_parcours=True)
return tab
-def tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, format):
+def tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, fmt):
"""Element de formulaire pour choisir si restriction aux primos entrants et groupement par lycees"""
F = ["""""")
return "\n".join(F)
def formsemestre_suivi_cursus(
formsemestre_id,
- format="html",
+ fmt="html",
only_primo=False,
no_grouping=False,
):
@@ -1290,10 +1290,10 @@ def formsemestre_suivi_cursus(
tab.base_url += "&only_primo=1"
if no_grouping:
tab.base_url += "&no_grouping=1"
- t = tab.make_page(format=format, with_html_headers=False)
- if format != "html":
+ t = tab.make_page(fmt=fmt, with_html_headers=False)
+ if fmt != "html":
return t
- F = [tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, format)]
+ F = [tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, fmt)]
H = [
html_sco_header.sco_header(
@@ -1312,7 +1312,7 @@ def formsemestre_suivi_cursus(
# -------------
def graph_cursus(
formsemestre_id,
- format="svg",
+ fmt="svg",
only_primo=False,
bac="", # selection sur type de bac
bacspecialite="",
@@ -1437,7 +1437,7 @@ def graph_cursus(
g.add_node(n)
g.set("rankdir", "LR") # left to right
g.set_fontname("Helvetica")
- if format == "svg":
+ if fmt == "svg":
g.set_bgcolor("#fffff0") # ou 'transparent'
# titres des semestres:
for s in sems.values():
@@ -1489,7 +1489,7 @@ def graph_cursus(
n.set("label", "Diplome") # bug si accent (pas compris pourquoi)
# Arètes:
bubbles = {} # substitue titres pour bulle aides: src_id:dst_id : etud_descr
- for (src_id, dst_id) in edges.keys():
+ for src_id, dst_id in edges.keys():
e = g.get_edge(src_id, dst_id)[0]
e.set("arrowhead", "normal")
e.set("arrowsize", 1)
@@ -1503,20 +1503,19 @@ def graph_cursus(
e.set_URL(f"__xxxetudlist__?{src_id}:{dst_id}")
# Genere graphe
_, path = tempfile.mkstemp(".gr")
- g.write(path=path, format=format)
+ g.write(path=path, format=fmt)
with open(path, "rb") as f:
data = f.read()
- log("dot generated %d bytes in %s format" % (len(data), format))
+ log("dot generated %d bytes in %s format" % (len(data), fmt))
if not data:
log("graph.to_string=%s" % g.to_string())
- raise ValueError(
- "Erreur lors de la génération du document au format %s" % format
- )
+ raise ValueError("Erreur lors de la génération du document au format %s" % fmt)
os.unlink(path)
- if format == "svg":
+ if fmt == "svg":
# dot génère un document XML complet, il faut enlever l'en-tête
data_str = data.decode("utf-8")
data = "