diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py
index 8fe5e5d95..c041c6933 100644
--- a/app/scodoc/html_sidebar.py
+++ b/app/scodoc/html_sidebar.py
@@ -135,7 +135,7 @@ def sidebar(context, REQUEST=None):
"""
% params
)
- if sco_preferences.get_preference(context, "handle_billets_abs"):
+ if sco_preferences.get_preference("handle_billets_abs"):
H.append(
"""
Pas inscrit dans un semestre courant,
@@ -180,7 +180,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
else:
formsemestre_id = etud["cursem"]["formsemestre_id"]
require_module = sco_preferences.get_preference(
- context, "abs_require_module", formsemestre_id
+ "abs_require_module", formsemestre_id
)
nt = sco_cache.NotesTableCache.get(formsemestre_id)
ues = nt.get_ues(etudid=etudid)
@@ -839,9 +839,7 @@ def ListeAbsEtud(
base_url=base_url_nj,
filename="abs_" + scu.make_filename(etud["nomprenom"]),
caption="Absences non justifiées de %(nomprenom)s" % etud,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
tab_absjust = GenTable(
titles=titles,
@@ -852,9 +850,7 @@ def ListeAbsEtud(
base_url=base_url_j,
filename="absjust_" + scu.make_filename(etud["nomprenom"]),
caption="Absences justifiées de %(nomprenom)s" % etud,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
# Formats non HTML et demande d'une seule table:
diff --git a/app/scodoc/sco_apogee_compare.py b/app/scodoc/sco_apogee_compare.py
index 5079ed960..fa2df3225 100644
--- a/app/scodoc/sco_apogee_compare.py
+++ b/app/scodoc/sco_apogee_compare.py
@@ -266,9 +266,7 @@ def apo_table_compare_etud_results(context, A, B, REQUEST=None):
columns_ids=("nip", "nom", "prenom", "elt_code", "type_res", "val_A", "val_B"),
html_class="table_leftalign",
html_with_td_classes=True,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return T
diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py
index 26bb2f978..7755f35d8 100644
--- a/app/scodoc/sco_bulletins.py
+++ b/app/scodoc/sco_bulletins.py
@@ -100,7 +100,7 @@ def make_context_dict(context, sem, etud):
# copie preferences
# XXX devrait acceder directement à un dict de preferences, à revoir
for name in sco_preferences.get_base_preferences(context).prefs_name:
- C[name] = sco_preferences.get_preference(context, name, sem["formsemestre_id"])
+ C[name] = sco_preferences.get_preference(name, sem["formsemestre_id"])
# ajoute groupes et group_0, group_1, ...
sco_groups.etud_add_group_infos(context, etud, sem)
@@ -133,7 +133,7 @@ def formsemestre_bulletinetud_dict(
if not version in scu.BULLETINS_VERSIONS:
raise ValueError("invalid version code !")
- prefs = sco_preferences.SemPreferences(context, formsemestre_id)
+ prefs = sco_preferences.SemPreferences(formsemestre_id)
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > toutes notes
I = scu.DictDefault(defaultvalue="")
@@ -417,10 +417,10 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
Result: liste de modules de l'UE avec les infos dans chacun (seulement ceux où l'étudiant est inscrit).
"""
bul_show_mod_rangs = sco_preferences.get_preference(
- context, "bul_show_mod_rangs", formsemestre_id
+ "bul_show_mod_rangs", formsemestre_id
)
bul_show_abs_modules = sco_preferences.get_preference(
- context, "bul_show_abs_modules", formsemestre_id
+ "bul_show_abs_modules", formsemestre_id
)
if bul_show_abs_modules:
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
@@ -481,9 +481,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'
'
% (modimpl["moduleimpl_id"], mod["mod_descr_txt"])
)
- if sco_preferences.get_preference(
- context, "bul_show_codemodules", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_codemodules", formsemestre_id):
mod["code"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code"] + ""
else:
@@ -502,9 +500,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'
'
% (modimpl["moduleimpl_id"], mod_descr)
)
- if sco_preferences.get_preference(
- context, "bul_show_codemodules", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_codemodules", formsemestre_id):
mod["code_txt"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code_txt"] + ""
else:
@@ -565,9 +561,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
# Evaluations incomplètes ou futures:
mod["evaluations_incompletes"] = []
- if sco_preferences.get_preference(
- context, "bul_show_all_evals", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id):
complete_eval_ids = set([e["evaluation_id"] for e in evals])
all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]}
@@ -784,7 +778,7 @@ def formsemestre_bulletinetud(
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
except:
- return scu.log_unknown_etud(context, REQUEST, format=format)
+ return scu.log_unknown_etud(REQUEST, format=format)
bulletin = do_formsemestre_bulletinetud(
context,
@@ -848,9 +842,7 @@ def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
return (
- sco_preferences.get_preference(
- context, "bul_mail_allowed_for_all", formsemestre_id
- )
+ sco_preferences.get_preference("bul_mail_allowed_for_all", formsemestre_id)
or authuser.has_permission(Permission.ScoImplement)
or str(authuser) in sem["responsables"]
)
@@ -978,18 +970,12 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
If bul_mail_list_abs pref is true, put list of absences in mail body (text).
"""
etud = I["etud"]
- webmaster = sco_preferences.get_preference(
- context, "bul_mail_contact_addr", formsemestre_id
- )
+ webmaster = sco_preferences.get_preference("bul_mail_contact_addr", formsemestre_id)
dept = scu.unescape_html(
- sco_preferences.get_preference(context, "DeptName", formsemestre_id)
- )
- copy_addr = sco_preferences.get_preference(
- context, "email_copy_bulletins", formsemestre_id
- )
- intro_mail = sco_preferences.get_preference(
- context, "bul_intro_mail", formsemestre_id
+ sco_preferences.get_preference("DeptName", formsemestre_id)
)
+ copy_addr = sco_preferences.get_preference("email_copy_bulletins", formsemestre_id)
+ intro_mail = sco_preferences.get_preference("bul_intro_mail", formsemestre_id)
if intro_mail:
hea = intro_mail % {
@@ -1000,7 +986,7 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
else:
hea = ""
- if sco_preferences.get_preference(context, "bul_mail_list_abs"):
+ if sco_preferences.get_preference("bul_mail_list_abs"):
hea += "\n\n" + sco_abs_views.ListeAbsEtud(
context, etud["etudid"], with_evals=False, format="text"
)
@@ -1009,9 +995,7 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
subj = Header("Relevé de notes de %s" % etud["nomprenom"], scu.SCO_ENCODING)
recipients = [recipient_addr]
msg["Subject"] = subj
- msg["From"] = sco_preferences.get_preference(
- context, "email_from_addr", formsemestre_id
- )
+ msg["From"] = sco_preferences.get_preference("email_from_addr", formsemestre_id)
msg["To"] = " ,".join(recipients)
if copy_addr:
msg["Bcc"] = copy_addr.strip()
diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py
index 561a5e377..fd7780c7d 100644
--- a/app/scodoc/sco_bulletins_generator.py
+++ b/app/scodoc/sco_bulletins_generator.py
@@ -89,9 +89,7 @@ def bulletin_get_class_name_displayed(context, formsemestre_id):
"""Le nom du générateur utilisé, en clair"""
from app.scodoc import sco_preferences
- bul_class_name = sco_preferences.get_preference(
- context, "bul_class_name", formsemestre_id
- )
+ bul_class_name = sco_preferences.get_preference("bul_class_name", formsemestre_id)
try:
gen_class = bulletin_get_class(bul_class_name)
return gen_class.description
@@ -127,7 +125,7 @@ class BulletinGenerator(object):
self.server_name = server_name
# Store preferences for convenience:
formsemestre_id = self.infos["formsemestre_id"]
- self.preferences = sco_preferences.SemPreferences(context, formsemestre_id)
+ self.preferences = sco_preferences.SemPreferences(formsemestre_id)
self.diagnostic = None # error message if any problem
# Common PDF styles:
# - Pour tous les champs du bulletin sauf les cellules de table:
@@ -285,9 +283,7 @@ def make_formsemestre_bulletinetud(
raise ValueError("invalid version code !")
formsemestre_id = infos["formsemestre_id"]
- bul_class_name = sco_preferences.get_preference(
- context, "bul_class_name", formsemestre_id
- )
+ bul_class_name = sco_preferences.get_preference("bul_class_name", formsemestre_id)
try:
gen_class = bulletin_get_class(bul_class_name)
except:
diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py
index 7e0e18fff..f1626f183 100644
--- a/app/scodoc/sco_bulletins_json.py
+++ b/app/scodoc/sco_bulletins_json.py
@@ -158,8 +158,7 @@ def formsemestre_bulletinetud_published_dict(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if (
nt.get_moduleimpls_attente()
- or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id)
- == 0
+ or sco_preferences.get_preference("bul_show_rangs", formsemestre_id) == 0
):
# n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre
@@ -254,9 +253,7 @@ def formsemestre_bulletinetud_published_dict(
m["note"][k] = scu.fmt_note(m["note"][k])
u["module"].append(m)
- if sco_preferences.get_preference(
- context, "bul_show_mod_rangs", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id):
m["rang"] = dict(
value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]
)
@@ -293,7 +290,7 @@ def formsemestre_bulletinetud_published_dict(
# Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals])
if sco_preferences.get_preference(
- context, "bul_show_all_evals", formsemestre_id
+ "bul_show_all_evals", formsemestre_id
):
all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]}
@@ -338,13 +335,13 @@ def formsemestre_bulletinetud_published_dict(
)
# --- Absences
- if sco_preferences.get_preference(context, "bul_show_abs", formsemestre_id):
+ if sco_preferences.get_preference("bul_show_abs", formsemestre_id):
nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem)
d["absences"] = dict(nbabs=nbabs, nbabsjust=nbabsjust)
# --- Decision Jury
if (
- sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
+ sco_preferences.get_preference("bul_show_decision", formsemestre_id)
or xml_with_decisions
):
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
@@ -353,7 +350,7 @@ def formsemestre_bulletinetud_published_dict(
formsemestre_id,
format="xml",
show_uevalid=sco_preferences.get_preference(
- context, "bul_show_uevalid", formsemestre_id
+ "bul_show_uevalid", formsemestre_id
),
)
d["situation"] = scu.quote_xml_attr(infos["situation"])
@@ -377,7 +374,7 @@ def formsemestre_bulletinetud_published_dict(
d["decision_ue"] = []
if decision[
"decisions_ue"
- ]: # and sco_preferences.get_preference(context, 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
+ ]: # and sco_preferences.get_preference( 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
for ue_id in decision["decisions_ue"].keys():
ue = sco_edit_ue.do_ue_list(context, {"ue_id": ue_id})[0]
d["decision_ue"].append(
diff --git a/app/scodoc/sco_bulletins_legacy.py b/app/scodoc/sco_bulletins_legacy.py
index 96dafd258..318e479c1 100644
--- a/app/scodoc/sco_bulletins_legacy.py
+++ b/app/scodoc/sco_bulletins_legacy.py
@@ -88,7 +88,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
context = self.context
bul_show_abs_modules = sco_preferences.get_preference(
- context, "bul_show_abs_modules", formsemestre_id
+ "bul_show_abs_modules", formsemestre_id
)
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
@@ -103,7 +103,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
H = ['
' % bgcolor]
- if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
+ if sco_preferences.get_preference("bul_show_minmax", formsemestre_id):
minmax = (
'[%s, %s]'
% (I["moy_min"], I["moy_max"])
@@ -129,7 +129,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
continue # saute les modules où on n'est pas inscrit
H.append('' % rowstyle)
if sco_preferences.get_preference(
- context, "bul_show_minmax_mod", formsemestre_id
+ "bul_show_minmax_mod", formsemestre_id
):
rang_minmax = '%s [%s, %s]' % (
mod["mod_rang_txt"],
@@ -178,7 +178,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
plusminus = minuslink #
if ue["ue_status"]["is_capitalized"]:
if sco_preferences.get_preference(
- context, "bul_show_ue_cap_details", formsemestre_id
+ "bul_show_ue_cap_details", formsemestre_id
):
plusminus = minuslink
hide = ""
@@ -209,9 +209,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
)
H.append('
')
- if sco_preferences.get_preference(
- context, "bul_show_minmax", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_minmax", formsemestre_id):
moy_txt = (
'%s [%s, %s]'
% (
@@ -448,10 +446,10 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
P = [] # elems pour gen. pdf
formsemestre_id = I["formsemestre_id"]
bul_show_abs_modules = sco_preferences.get_preference(
- context, "bul_show_abs_modules", formsemestre_id
+ "bul_show_abs_modules", formsemestre_id
)
- if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
+ if sco_preferences.get_preference("bul_show_minmax", formsemestre_id):
minmax = ' [%s, %s]' % (I["moy_min"], I["moy_max"])
else:
minmax = ""
@@ -473,9 +471,7 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
if mod["mod_moy_txt"] == "NI":
continue # saute les modules où on n'est pas inscrit
S.modline(ue_type=ue_type)
- if sco_preferences.get_preference(
- context, "bul_show_minmax_mod", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_minmax_mod", formsemestre_id):
rang_minmax = '%s [%s, %s]' % (
mod["mod_rang_txt"],
scu.fmt_note(mod["stats"]["min"]),
@@ -516,12 +512,12 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
ue_descr = "(en cours, non prise en compte)"
S.ueline()
if sco_preferences.get_preference(
- context, "bul_show_ue_cap_details", formsemestre_id
+ "bul_show_ue_cap_details", formsemestre_id
):
list_modules(ue["modules_capitalized"])
ue_type = "cur"
- if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
+ if sco_preferences.get_preference("bul_show_minmax", formsemestre_id):
moy_txt = '%s [%s, %s]' % (
ue["cur_moy_ue_txt"],
ue["min"],
diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py
index 5e23a8425..07e1a88ce 100644
--- a/app/scodoc/sco_bulletins_pdf.py
+++ b/app/scodoc/sco_bulletins_pdf.py
@@ -86,10 +86,10 @@ def pdfassemblebulletins(
return ""
# Paramètres de mise en page
margins = (
- sco_preferences.get_preference(context, "left_margin", formsemestre_id),
- sco_preferences.get_preference(context, "top_margin", formsemestre_id),
- sco_preferences.get_preference(context, "right_margin", formsemestre_id),
- sco_preferences.get_preference(context, "bottom_margin", formsemestre_id),
+ sco_preferences.get_preference("left_margin", formsemestre_id),
+ sco_preferences.get_preference("top_margin", formsemestre_id),
+ sco_preferences.get_preference("right_margin", formsemestre_id),
+ sco_preferences.get_preference("bottom_margin", formsemestre_id),
)
report = StringIO.StringIO() # in-memory document, no disk file
@@ -105,7 +105,7 @@ def pdfassemblebulletins(
margins=margins,
pagesbookmarks=pagesbookmarks,
filigranne=filigranne,
- preferences=sco_preferences.SemPreferences(context, formsemestre_id),
+ preferences=sco_preferences.SemPreferences(formsemestre_id),
)
)
document.build(objects)
@@ -194,9 +194,7 @@ def get_formsemestre_bulletins_pdf(
bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid))
i = i + 1
#
- infos = {
- "DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)
- }
+ infos = {"DeptName": sco_preferences.get_preference("DeptName", formsemestre_id)}
if REQUEST:
server_name = REQUEST.BASE0
else:
@@ -248,7 +246,7 @@ def get_etud_bulletins_pdf(context, etudid, REQUEST, version="selectedevals"):
filigrannes[i] = filigranne
bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015
i = i + 1
- infos = {"DeptName": sco_preferences.get_preference(context, "DeptName")}
+ infos = {"DeptName": sco_preferences.get_preference("DeptName")}
if REQUEST:
server_name = REQUEST.BASE0
else:
diff --git a/app/scodoc/sco_bulletins_standard.py b/app/scodoc/sco_bulletins_standard.py
index 4e86c091b..b30dc4c41 100644
--- a/app/scodoc/sco_bulletins_standard.py
+++ b/app/scodoc/sco_bulletins_standard.py
@@ -278,7 +278,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
context = self.context
P = [] # elems pour générer table avec gen_table (liste de dicts)
formsemestre_id = I["formsemestre_id"]
- prefs = sco_preferences.SemPreferences(context, formsemestre_id)
+ prefs = sco_preferences.SemPreferences(formsemestre_id)
# Colonnes à afficher:
with_col_abs = prefs["bul_show_abs_modules"]
diff --git a/app/scodoc/sco_bulletins_ucac.py b/app/scodoc/sco_bulletins_ucac.py
index a474592b2..17ccf269d 100644
--- a/app/scodoc/sco_bulletins_ucac.py
+++ b/app/scodoc/sco_bulletins_ucac.py
@@ -72,7 +72,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
I = self.infos
context = self.context
formsemestre_id = I["formsemestre_id"]
- prefs = sco_preferences.SemPreferences(context, formsemestre_id)
+ prefs = sco_preferences.SemPreferences(formsemestre_id)
P = [] # elems pour générer table avec gen_table (liste de dicts)
@@ -192,7 +192,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
# --- UE capitalisée:
if ue["ue_status"]["is_capitalized"]:
if sco_preferences.get_preference(
- context, "bul_show_ue_cap_details", formsemestre_id
+ "bul_show_ue_cap_details", formsemestre_id
):
nb_modules = len(ue["modules_capitalized"])
hidden = False
diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py
index 6bcd55e85..0440e287e 100644
--- a/app/scodoc/sco_bulletins_xml.py
+++ b/app/scodoc/sco_bulletins_xml.py
@@ -151,8 +151,7 @@ def make_xml_formsemestre_bulletinetud(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if (
nt.get_moduleimpls_attente()
- or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id)
- == 0
+ or sco_preferences.get_preference("bul_show_rangs", formsemestre_id) == 0
):
# n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre
@@ -255,9 +254,7 @@ def make_xml_formsemestre_bulletinetud(
moy=scu.fmt_note(modstat["moy"]),
)
)
- if sco_preferences.get_preference(
- context, "bul_show_mod_rangs", formsemestre_id
- ):
+ if sco_preferences.get_preference("bul_show_mod_rangs", formsemestre_id):
x_mod.append(
Element(
"rang",
@@ -298,7 +295,7 @@ def make_xml_formsemestre_bulletinetud(
# Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals])
if sco_preferences.get_preference(
- context, "bul_show_all_evals", formsemestre_id
+ "bul_show_all_evals", formsemestre_id
):
all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]}
@@ -349,12 +346,12 @@ def make_xml_formsemestre_bulletinetud(
)
# --- Absences
- if sco_preferences.get_preference(context, "bul_show_abs", formsemestre_id):
+ if sco_preferences.get_preference("bul_show_abs", formsemestre_id):
nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem)
doc.append(Element("absences", nbabs=nbabs, nbabsjust=nbabsjust))
# --- Decision Jury
if (
- sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
+ sco_preferences.get_preference("bul_show_decision", formsemestre_id)
or xml_with_decisions
):
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
@@ -363,7 +360,7 @@ def make_xml_formsemestre_bulletinetud(
formsemestre_id,
format="xml",
show_uevalid=sco_preferences.get_preference(
- context, "bul_show_uevalid", formsemestre_id
+ "bul_show_uevalid", formsemestre_id
),
)
x_situation = Element("situation")
@@ -395,7 +392,7 @@ def make_xml_formsemestre_bulletinetud(
if decision[
"decisions_ue"
- ]: # and sco_preferences.get_preference(context, 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
+ ]: # and sco_preferences.get_preference( 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
for ue_id in decision["decisions_ue"].keys():
ue = sco_edit_ue.do_ue_list(context, {"ue_id": ue_id})[0]
doc.append(
diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py
index 07b8aabd0..49ee2d95e 100644
--- a/app/scodoc/sco_cache.py
+++ b/app/scodoc/sco_cache.py
@@ -132,8 +132,7 @@ class EvaluationCache(ScoDocCache):
WHERE s.formsemestre_id = %(formsemestre_id)s and s.formsemestre_id=m.formsemestre_id and e.moduleimpl_id=m.moduleimpl_id;
"""
evaluation_ids = [
- x[0]
- for x in ndb.SimpleQuery(None, req, {"formsemestre_id": formsemestre_id})
+ x[0] for x in ndb.SimpleQuery(req, {"formsemestre_id": formsemestre_id})
]
cls.delete_many(evaluation_ids)
@@ -142,9 +141,7 @@ class EvaluationCache(ScoDocCache):
"delete all evaluations from cache"
evaluation_ids = [
x[0]
- for x in ndb.SimpleQuery(
- None, "SELECT evaluation_id FROM notes_evaluation", ""
- )
+ for x in ndb.SimpleQuery("SELECT evaluation_id FROM notes_evaluation", "")
]
cls.delete_many(evaluation_ids)
@@ -224,7 +221,8 @@ class NotesTableCache(ScoDocCache):
from app.scodoc import notes_table
t0 = time.time()
- nt = notes_table.NotesTable(None, formsemestre_id)
+ context = None # XXX TO REMOVE #context
+ nt = notes_table.NotesTable(context, formsemestre_id)
dt = time.time() - t0
log("caching formsemestre_id=%s (%gs)" % (formsemestre_id, dt))
_ = cls.set(formsemestre_id, nt)
@@ -247,7 +245,7 @@ def invalidate_formsemestre( # was inval_cache( context, formsemestre_id=None,
formsemestre_ids = [
x[0]
for x in ndb.SimpleQuery(
- None, "SELECT formsemestre_id FROM notes_formsemestre", ""
+ "SELECT formsemestre_id FROM notes_formsemestre", ""
)
]
else:
diff --git a/app/scodoc/sco_cost_formation.py b/app/scodoc/sco_cost_formation.py
index eef25381a..800b614b1 100644
--- a/app/scodoc/sco_cost_formation.py
+++ b/app/scodoc/sco_cost_formation.py
@@ -121,7 +121,7 @@ def formsemestre_table_estim_cost(
),
rows=T,
html_sortable=True,
- preferences=sco_preferences.SemPreferences(context, formsemestre_id),
+ preferences=sco_preferences.SemPreferences(formsemestre_id),
html_class="table_leftalign table_listegroupe",
xls_before_table=[
["%(titre)s %(num_sem)s %(modalitestr)s" % sem],
diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py
index 7a1b99a9b..3d1a61c47 100644
--- a/app/scodoc/sco_debouche.py
+++ b/app/scodoc/sco_debouche.py
@@ -82,7 +82,7 @@ def get_etudids_with_debouche(context, start_year):
start_date = str(start_year) + "-01-01"
# Recupere tous les etudid avec un debouché renseigné et une inscription dans un semestre
# posterieur à la date de depart:
- # r = ndb.SimpleDictFetch(context,
+ # r = ndb.SimpleDictFetch(
# """SELECT DISTINCT i.etudid
# FROM notes_formsemestre_inscription i, admissions adm, notes_formsemestre s
# WHERE adm.debouche is not NULL
@@ -92,7 +92,6 @@ def get_etudids_with_debouche(context, start_year):
# {'start_date' : start_date })
r = ndb.SimpleDictFetch(
- context,
"""SELECT DISTINCT i.etudid
FROM notes_formsemestre_inscription i, notes_formsemestre s, itemsuivi it
WHERE i.etudid = it.etudid
@@ -189,9 +188,7 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
# html_col_width='4em',
html_sortable=True,
html_class="table_leftalign table_listegroupe",
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return tab
@@ -338,7 +335,6 @@ def itemsuivi_list_etud(context, etudid, format=None, REQUEST=None):
def itemsuivi_tag_list(context, itemsuivi_id):
"""les noms de tags associés à cet item"""
r = ndb.SimpleDictFetch(
- context,
"""SELECT t.title
FROM itemsuivi_tags_assoc a, itemsuivi_tags t
WHERE a.tag_id = t.tag_id
@@ -356,7 +352,6 @@ def itemsuivi_tag_search(context, term, REQUEST=None):
data = []
else:
r = ndb.SimpleDictFetch(
- context,
"SELECT title FROM itemsuivi_tags WHERE title LIKE %(term)s",
{"term": term + "%"},
)
diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py
index 6d5471f25..d2451c01e 100644
--- a/app/scodoc/sco_dept.py
+++ b/app/scodoc/sco_dept.py
@@ -125,7 +125,7 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0):
"""
Semestres de %s
"""
- % sco_preferences.get_preference(context, "DeptName")
+ % sco_preferences.get_preference("DeptName")
)
H.append(_sem_table_gt(context, sems).html())
H.append("
")
@@ -250,9 +250,7 @@ def _sem_table_gt(context, sems, showcodes=False):
html_sortable=True,
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
# caption='Maquettes enregistrées',
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return tab
diff --git a/app/scodoc/sco_dump_db.py b/app/scodoc/sco_dump_db.py
index 784819680..e9ccb3387 100644
--- a/app/scodoc/sco_dump_db.py
+++ b/app/scodoc/sco_dump_db.py
@@ -70,7 +70,7 @@ def sco_dump_and_send_db(context, REQUEST=None):
html_sco_header.sco_header(context, REQUEST, page_title="Assistance technique")
]
# get currect (dept) DB name:
- cursor = ndb.SimpleQuery(context, "SELECT current_database()", {})
+ cursor = ndb.SimpleQuery("SELECT current_database()", {})
db_name = cursor.fetchone()[0]
ano_db_name = "ANO" + db_name
# Lock
@@ -190,7 +190,7 @@ def _send_db(context, REQUEST, ano_db_name):
scu.SCO_DUMP_UP_URL,
files=files,
data={
- "dept_name": sco_preferences.get_preference(context, "DeptName"),
+ "dept_name": sco_preferences.get_preference("DeptName"),
"serial": _get_scodoc_serial(context),
"sco_user": str(REQUEST.AUTHENTICATED_USER),
"sent_by": sco_users.user_info(str(REQUEST.AUTHENTICATED_USER))[
diff --git a/app/scodoc/sco_edit_matiere.py b/app/scodoc/sco_edit_matiere.py
index e909dafa3..0ab757fd7 100644
--- a/app/scodoc/sco_edit_matiere.py
+++ b/app/scodoc/sco_edit_matiere.py
@@ -314,7 +314,6 @@ associé.
if tf[2]["ue_id"] != F["ue_id"]:
log("attaching mat %s to new UE %s" % (matiere_id, tf[2]["ue_id"]))
ndb.SimpleQuery(
- context,
"UPDATE notes_modules SET ue_id = %(ue_id)s WHERE matiere_id=%(matiere_id)s",
{"ue_id": tf[2]["ue_id"], "matiere_id": matiere_id},
)
@@ -329,7 +328,6 @@ def matiere_is_locked(context, matiere_id):
(contains modules used in a locked formsemestre)
"""
r = ndb.SimpleDictFetch(
- context,
"""SELECT ma.* from notes_matieres ma, notes_modules mod, notes_formsemestre sem, notes_moduleimpl mi
WHERE ma.matiere_id = mod.matiere_id AND mi.module_id = mod.module_id AND mi.formsemestre_id = sem.formsemestre_id
AND ma.matiere_id = %(matiere_id)s AND sem.etat = 0
diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py
index 5510567ca..1582cb5c2 100644
--- a/app/scodoc/sco_edit_module.py
+++ b/app/scodoc/sco_edit_module.py
@@ -359,7 +359,6 @@ def module_edit(context, module_id=None, REQUEST=None):
)[0]
parcours = sco_codes_parcours.get_parcours_from_code(Fo["type_parcours"])
M = ndb.SimpleDictFetch(
- context,
"SELECT ue.acronyme, mat.* FROM notes_matieres mat, notes_ue ue WHERE mat.ue_id = ue.ue_id AND ue.formation_id = %(formation_id)s ORDER BY ue.numero, mat.numero",
{"formation_id": Mod["formation_id"]},
)
@@ -571,7 +570,6 @@ def module_is_locked(context, module_id):
(used in a locked formsemestre)
"""
r = ndb.SimpleDictFetch(
- context,
"""SELECT mi.* from notes_modules mod, notes_formsemestre sem, notes_moduleimpl mi
WHERE mi.module_id = mod.module_id AND mi.formsemestre_id = sem.formsemestre_id
AND mi.module_id = %(module_id)s AND sem.etat = 0
diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py
index cd3a2e7fe..86c9ec142 100644
--- a/app/scodoc/sco_edit_ue.py
+++ b/app/scodoc/sco_edit_ue.py
@@ -144,7 +144,6 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
if delete_validations:
log("deleting all validations of UE %s" % ue_id)
ndb.SimpleQuery(
- context,
"DELETE FROM scolar_formsemestre_validation WHERE ue_id=%(ue_id)s",
{"ue_id": ue_id},
)
@@ -155,13 +154,10 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
sco_edit_matiere.do_matiere_delete(context, mat["matiere_id"], REQUEST)
# delete uecoef and events
ndb.SimpleQuery(
- context,
"DELETE FROM notes_formsemestre_uecoef WHERE ue_id=%(ue_id)s",
{"ue_id": ue_id},
)
- ndb.SimpleQuery(
- context, "DELETE FROM scolar_events WHERE ue_id=%(ue_id)s", {"ue_id": ue_id}
- )
+ ndb.SimpleQuery("DELETE FROM scolar_events WHERE ue_id=%(ue_id)s", {"ue_id": ue_id})
cnx = ndb.GetDBConnexion()
_ueEditor.delete(cnx, ue_id)
# > UE delete + supr. validations associées etudiants (cas compliqué, mais rarement utilisé: acceptable de tout invalider ?):
@@ -949,7 +945,6 @@ def ue_is_locked(context, ue_id):
(contains modules used in a locked formsemestre)
"""
r = ndb.SimpleDictFetch(
- context,
"""SELECT ue.* FROM notes_ue ue, notes_modules mod, notes_formsemestre sem, notes_moduleimpl mi
WHERE ue.ue_id = mod.ue_id
AND mi.module_id = mod.module_id AND mi.formsemestre_id = sem.formsemestre_id
@@ -1042,9 +1037,7 @@ def formation_table_recap(context, formation_id, format="html", REQUEST=None):
page_title=title,
html_title="
" + title + "
",
pdf_title=title,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return tab.make_page(context, format=format, REQUEST=REQUEST)
diff --git a/app/scodoc/sco_edt_cal.py b/app/scodoc/sco_edt_cal.py
index 08658b5fa..28d802f92 100644
--- a/app/scodoc/sco_edt_cal.py
+++ b/app/scodoc/sco_edt_cal.py
@@ -55,7 +55,7 @@ def formsemestre_get_ics_url(context, sem):
https://example.fr/agenda/{sem[etapes][0]}
"""
ics_url_tmpl = sco_preferences.get_preference(
- context, "edt_sem_ics_url", sem["formsemestre_id"]
+ "edt_sem_ics_url", sem["formsemestre_id"]
)
if not ics_url_tmpl:
return None
@@ -102,7 +102,7 @@ def get_edt_transcodage_groups(context, formsemestre_id):
edt2sco = {}
sco2edt = {}
msg = "" # message erreur, '' si ok
- txt = sco_preferences.get_preference(context, "edt_groups2scodoc", formsemestre_id)
+ txt = sco_preferences.get_preference("edt_groups2scodoc", formsemestre_id)
if not txt:
return edt2sco, sco2edt, msg
diff --git a/app/scodoc/sco_etape_apogee_view.py b/app/scodoc/sco_etape_apogee_view.py
index 06ed2fc06..0d105a56c 100644
--- a/app/scodoc/sco_etape_apogee_view.py
+++ b/app/scodoc/sco_etape_apogee_view.py
@@ -82,9 +82,7 @@ def apo_semset_maq_status(
block_export_res_modules = int(block_export_res_modules)
block_export_res_sdj = int(block_export_res_sdj)
- prefs = sco_preferences.SemPreferences(
- context,
- )
+ prefs = sco_preferences.SemPreferences()
tab_archives = table_apo_csv_list(context, semset, REQUEST=REQUEST)
@@ -486,9 +484,7 @@ def table_apo_csv_list(context, semset, REQUEST=None):
html_sortable=True,
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
# caption='Maquettes enregistrées',
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return tab
@@ -597,9 +593,7 @@ def _view_etuds_page(
html_sortable=True,
html_class="table_leftalign",
filename="students_apo",
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
if format != "html":
return tab.make_page(context, format=format, REQUEST=REQUEST)
@@ -785,9 +779,7 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
base_url="%s?etape_apo=%s&semset_id=%s" % (REQUEST.URL0, etape_apo, semset_id),
filename="students_" + etape_apo,
caption="Etudiants Apogée en " + etape_apo,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
if format != "html":
@@ -823,9 +815,7 @@ def apo_csv_export_results(
# nota: on peut éventuellement exporter même si tout n'est pas ok
# mais le lien via le tableau de bord n'est pas actif
# Les fichiers résultats ne sont pas stockés: pas besoin de permission particulière
- prefs = sco_preferences.SemPreferences(
- context,
- )
+ prefs = sco_preferences.SemPreferences()
export_res_etape = prefs["export_res_etape"] and not int(block_export_res_etape)
export_res_sem = prefs["export_res_sem"] and not int(block_export_res_sem)
export_res_ues = prefs["export_res_ues"] and not int(block_export_res_ues)
@@ -866,7 +856,7 @@ def apo_csv_export_results(
)
basename = (
- sco_preferences.get_preference(context, "DeptName")
+ sco_preferences.get_preference("DeptName")
+ str(annee_scolaire)
+ "-%s-" % periode
+ "-".join(etapes_apo)
diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py
index cc17bb77a..3cad157b7 100644
--- a/app/scodoc/sco_etud.py
+++ b/app/scodoc/sco_etud.py
@@ -377,9 +377,7 @@ def identite_edit(cnx, args, context=None, REQUEST=None):
notify_to = None
if context:
try:
- notify_to = sco_preferences.get_preference(
- context, "notify_etud_changes_to"
- )
+ notify_to = sco_preferences.get_preference("notify_etud_changes_to")
except:
pass
@@ -446,7 +444,7 @@ def notify_etud_change(context, email_addr, etud, before, after, subject):
msg = MIMEMultipart()
subj = Header("[ScoDoc] " + subject, SCO_ENCODING)
msg["Subject"] = subj
- msg["From"] = sco_preferences.get_preference(context, "email_from_addr")
+ msg["From"] = sco_preferences.get_preference("email_from_addr")
msg["To"] = email_addr
mime_txt = MIMEText(txt, "plain", SCO_ENCODING)
msg.attach(mime_txt)
@@ -492,9 +490,7 @@ def adresse_edit(cnx, args, context=None):
notify_to = None
if context:
try:
- notify_to = sco_preferences.get_preference(
- context, "notify_etud_changes_to"
- )
+ notify_to = sco_preferences.get_preference("notify_etud_changes_to")
except:
pass
if notify_to:
diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py
index eba208b8a..9e78486e2 100644
--- a/app/scodoc/sco_evaluations.py
+++ b/app/scodoc/sco_evaluations.py
@@ -930,7 +930,7 @@ def formsemestre_evaluations_delai_correction(
html_sortable=True,
html_title="
Correction des évaluations du semestre
",
caption="Correction des évaluations du semestre",
- preferences=sco_preferences.SemPreferences(context, formsemestre_id),
+ preferences=sco_preferences.SemPreferences(formsemestre_id),
base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id),
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
filename=scu.make_filename("evaluations_delais_" + sem["titreannee"]),
diff --git a/app/scodoc/sco_excel.py b/app/scodoc/sco_excel.py
index 509255165..1b0ea311c 100644
--- a/app/scodoc/sco_excel.py
+++ b/app/scodoc/sco_excel.py
@@ -571,7 +571,7 @@ def Excel_feuille_listeappel(
(
"%s %s (%s - %s)"
% (
- sco_preferences.get_preference(context, "DeptName", formsemestre_id),
+ sco_preferences.get_preference("DeptName", formsemestre_id),
notesdb.unquote(sem["titre_num"]),
sem["date_debut"],
sem["date_fin"],
diff --git a/app/scodoc/sco_export_results.py b/app/scodoc/sco_export_results.py
index dac44bf43..ba0b92577 100644
--- a/app/scodoc/sco_export_results.py
+++ b/app/scodoc/sco_export_results.py
@@ -102,9 +102,7 @@ def _build_results_table(context, start_date=None, end_date=None, types_parcours
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
html_class="table_leftalign",
html_sortable=True,
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
return tab, semlist
@@ -207,7 +205,6 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
def get_set_formsemestre_id_dates(context, start_date, end_date):
"""Ensemble des formsemestre_id entre ces dates"""
s = ndb.SimpleDictFetch(
- context,
"SELECT formsemestre_id FROM notes_formsemestre WHERE date_debut >= %(start_date)s AND date_fin <= %(end_date)s",
{"start_date": start_date, "end_date": end_date},
)
diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py
index 69bde973b..c9952b0e4 100644
--- a/app/scodoc/sco_find_etud.py
+++ b/app/scodoc/sco_find_etud.py
@@ -166,9 +166,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
rows=etuds,
html_sortable=True,
html_class="table_leftalign",
- preferences=sco_preferences.SemPreferences(
- context,
- ),
+ preferences=sco_preferences.SemPreferences(),
)
H.append(tab.html())
if len(etuds) > 20: # si la page est grande
@@ -224,7 +222,6 @@ def search_etud_by_name(context, term, REQUEST=None):
else:
if may_be_nip:
r = ndb.SimpleDictFetch(
- context,
"SELECT nom, prenom, code_nip FROM identite WHERE code_nip LIKE %(beginning)s ORDER BY nom",
{"beginning": term + "%"},
)
@@ -238,7 +235,6 @@ def search_etud_by_name(context, term, REQUEST=None):
]
else:
r = ndb.SimpleDictFetch(
- context,
"SELECT etudid, nom, prenom FROM identite WHERE nom LIKE %(beginning)s ORDER BY nom",
{"beginning": term + "%"},
)
@@ -257,20 +253,6 @@ def search_etud_by_name(context, term, REQUEST=None):
# ---------- Recherche sur plusieurs département
-def form_search_etud_in_accessible_depts(context, REQUEST):
- """Form recherche etudiants pour page accueil ScoDoc"""
- authuser = REQUEST.AUTHENTICATED_USER
- # present form only to authenticated users
- if not authuser.has_role("Authenticated"):
- return ""
- return """