WIP refactoring: caches

This commit is contained in:
Emmanuel Viennet 2021-06-13 23:37:14 +02:00
parent 09a65b48ef
commit 23477faa3b
44 changed files with 504 additions and 303 deletions

View File

@ -698,7 +698,7 @@ def scolars_import_admission(
nline += 1 nline += 1
diag.append("%d lignes importées" % n_import) diag.append("%d lignes importées" % n_import)
if n_import > 0: if n_import > 0:
context._inval_cache(formsemestre_id=formsemestre_id) sco_core.inval_cache(context, formsemestre_id=formsemestre_id)
return diag return diag

View File

@ -60,7 +60,7 @@ import sco_bulletins_xml
def go(app, n=0, verbose=True): def go(app, n=0, verbose=True):
context = app.ScoDoc.objectValues("Folder")[n].Scolarite context = app.ScoDoc.objectValues("Folder")[n].Scolarite
if verbose: if verbose:
print("context in dept ", context.DeptId()) print("context in dept ", sco_core.get_dept_id())
return context return context
@ -72,9 +72,9 @@ def go_dept(app, dept, verbose=True):
except AttributeError: except AttributeError:
# ignore other folders, like old "icons" # ignore other folders, like old "icons"
continue continue
if context.DeptId() == dept: if sco_core.get_dept_id() == dept:
if verbose: if verbose:
print("context in dept ", context.DeptId()) print("context in dept ", sco_core.get_dept_id())
return context return context
raise ValueError("dep %s not found" % dept) raise ValueError("dep %s not found" % dept)

View File

@ -32,7 +32,7 @@ import time
import pdb import pdb
import inspect import inspect
import sco_core
import scolars import scolars
import sco_groups import sco_groups
from notes_log import log, logCallStack from notes_log import log, logCallStack
@ -173,7 +173,9 @@ class NotesTable:
self.moduleimpl_stats = {} # { moduleimpl_id : {stats} } self.moduleimpl_stats = {} # { moduleimpl_id : {stats} }
self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap
self._evaluations_etats = None # liste des evaluations avec état self._evaluations_etats = None # liste des evaluations avec état
self.use_ue_coefs = sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id) self.use_ue_coefs = sco_preferences.get_preference(
context, "use_ue_coefs", formsemestre_id
)
# Infos sur les etudiants # Infos sur les etudiants
self.inscrlist = context.do_formsemestre_inscription_list( self.inscrlist = context.do_formsemestre_inscription_list(
args={"formsemestre_id": formsemestre_id} args={"formsemestre_id": formsemestre_id}
@ -1173,7 +1175,7 @@ class NotesTable:
"comp_ue_capitalisees: recomputing UE moy (etudid=%s, ue_id=%s formsemestre_id=%s)" "comp_ue_capitalisees: recomputing UE moy (etudid=%s, ue_id=%s formsemestre_id=%s)"
% (etudid, ue_cap["ue_id"], ue_cap["formsemestre_id"]) % (etudid, ue_cap["ue_id"], ue_cap["formsemestre_id"])
) )
nt_cap = self.context._getNotesCache().get_NotesTable( nt_cap = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, ue_cap["formsemestre_id"] self.context, ue_cap["formsemestre_id"]
) # > UE capitalisees par un etud ) # > UE capitalisees par un etud
moy_ue_cap = nt_cap.get_etud_ue_status(etudid, ue_cap["ue_id"])[ moy_ue_cap = nt_cap.get_etud_ue_status(etudid, ue_cap["ue_id"])[
@ -1421,7 +1423,9 @@ class CacheNotesTable:
self.cache = {} self.cache = {}
self.pdfcache = {} self.pdfcache = {}
self._call_all_listeners() self._call_all_listeners()
context.get_evaluations_cache().inval_cache() sco_core.get_evaluations_cache(
context,
).inval_cache()
else: else:
# formsemestre_id modifié: # formsemestre_id modifié:
# on doit virer formsemestre_id et tous les semestres # on doit virer formsemestre_id et tous les semestres
@ -1438,7 +1442,9 @@ class CacheNotesTable:
) )
del self.cache[formsemestre_id] del self.cache[formsemestre_id]
self._call_listeners(formsemestre_id) self._call_listeners(formsemestre_id)
context.get_evaluations_cache().inval_cache() sco_core.get_evaluations_cache(
context,
).inval_cache()
for formsemestre_id in to_trash: for formsemestre_id in to_trash:
for ( for (

View File

@ -379,7 +379,9 @@ class ApoEtud(dict):
dict: with N, B, J, R keys, ou None si elt non trouvé dict: with N, B, J, R keys, ou None si elt non trouvé
""" """
etudid = self.etud["etudid"] etudid = self.etud["etudid"]
nt = context._getNotesCache().get_NotesTable(context, sem["formsemestre_id"]) nt = sco_core.get_notes_cache(
context,
).get_NotesTable(context, sem["formsemestre_id"])
if etudid not in nt.identdict: if etudid not in nt.identdict:
return None # etudiant non inscrit dans ce semestre return None # etudiant non inscrit dans ce semestre
@ -487,9 +489,9 @@ class ApoEtud(dict):
# l'étudiant n'a pas de semestre courant ?! # l'étudiant n'a pas de semestre courant ?!
log("comp_elt_annuel: %s no cur_sem" % etudid) log("comp_elt_annuel: %s no cur_sem" % etudid)
return VOID_APO_RES return VOID_APO_RES
cur_nt = context._getNotesCache().get_NotesTable( cur_nt = sco_core.get_notes_cache(
context, cur_sem["formsemestre_id"] context,
) ).get_NotesTable(context, cur_sem["formsemestre_id"])
cur_decision = cur_nt.get_etud_decision_sem(etudid) cur_decision = cur_nt.get_etud_decision_sem(etudid)
if not cur_decision: if not cur_decision:
# pas de decision => pas de résultat annuel # pas de decision => pas de résultat annuel
@ -506,9 +508,9 @@ class ApoEtud(dict):
decision_apo = code_scodoc_to_apo(cur_decision["code"]) decision_apo = code_scodoc_to_apo(cur_decision["code"])
autre_nt = context._getNotesCache().get_NotesTable( autre_nt = sco_core.get_notes_cache(
context, autre_sem["formsemestre_id"] context,
) ).get_NotesTable(context, autre_sem["formsemestre_id"])
autre_decision = autre_nt.get_etud_decision_sem(etudid) autre_decision = autre_nt.get_etud_decision_sem(etudid)
if not autre_decision: if not autre_decision:
# pas de decision dans l'autre => pas de résultat annuel # pas de decision dans l'autre => pas de résultat annuel
@ -571,9 +573,9 @@ class ApoEtud(dict):
# prend le plus recent avec decision # prend le plus recent avec decision
cur_sem = None cur_sem = None
for sem in cur_sems: for sem in cur_sems:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(
context, sem["formsemestre_id"] context,
) ).get_NotesTable(context, sem["formsemestre_id"])
decision = nt.get_etud_decision_sem(self.etud["etudid"]) decision = nt.get_etud_decision_sem(self.etud["etudid"])
if decision: if decision:
cur_sem = sem cur_sem = sem
@ -633,9 +635,9 @@ class ApoEtud(dict):
else: else:
autre_sem = None autre_sem = None
for sem in autres_sems: for sem in autres_sems:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(
context, sem["formsemestre_id"] context,
) ).get_NotesTable(context, sem["formsemestre_id"])
decision = nt.get_etud_decision_sem(self.etud["etudid"]) decision = nt.get_etud_decision_sem(self.etud["etudid"])
if decision: if decision:
autre_sem = sem autre_sem = sem
@ -968,9 +970,9 @@ class ApoData:
s.add(code) s.add(code)
continue continue
# associé à une UE: # associé à une UE:
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(
self.context, sem["formsemestre_id"] context,
) ).get_NotesTable(self.context, sem["formsemestre_id"])
for ue in nt.get_ues(): for ue in nt.get_ues():
if ue["code_apogee"] == code: if ue["code_apogee"] == code:
s.add(code) s.add(code)

View File

@ -93,7 +93,7 @@ class BaseArchiver:
:return: path to directory of archives for this object (eg formsemestre_id or etudid). :return: path to directory of archives for this object (eg formsemestre_id or etudid).
If directory does not yet exist, create it. If directory does not yet exist, create it.
""" """
dept_dir = os.path.join(self.root, context.DeptId()) dept_dir = os.path.join(self.root, sco_core.get_dept_id())
try: try:
scu.GSL.acquire() scu.GSL.acquire()
if not os.path.isdir(dept_dir): if not os.path.isdir(dept_dir):
@ -111,7 +111,7 @@ class BaseArchiver:
""" """
:return: list of archive oids :return: list of archive oids
""" """
base = os.path.join(self.root, context.DeptId()) + os.path.sep base = os.path.join(self.root, sco_core.get_dept_id()) + os.path.sep
dirs = glob.glob(base + "*") dirs = glob.glob(base + "*")
return [os.path.split(x)[1] for x in dirs] return [os.path.split(x)[1] for x in dirs]
@ -299,7 +299,8 @@ def do_formsemestre_archive(
if data: if data:
data = "\n".join( data = "\n".join(
[ [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Moyennes archivées le %s" % date, page_title="Moyennes archivées le %s" % date,
head_message="Moyennes archivées le %s" % date, head_message="Moyennes archivées le %s" % date,
@ -381,7 +382,8 @@ def formsemestre_archive(context, REQUEST, formsemestre_id, group_ids=[]):
) )
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Archiver les PV et résultats du semestre", "Archiver les PV et résultats du semestre",
sem=sem, sem=sem,
@ -503,7 +505,11 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
L.append(a) L.append(a)
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [html_sco_header.html_sem_header(context, REQUEST, "Archive des PV et résultats ", sem)] H = [
html_sco_header.html_sem_header(
context, REQUEST, "Archive des PV et résultats ", sem
)
]
if not L: if not L:
H.append("<p>aucune archive enregistrée</p>") H.append("<p>aucune archive enregistrée</p>")
else: else:

View File

@ -117,7 +117,7 @@ def formsemestre_bulletinetud_dict(
raise ValueError("invalid version code !") raise ValueError("invalid version code !")
prefs = sco_preferences.SemPreferences(context, formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > toutes notes ) # > toutes notes
@ -337,7 +337,7 @@ def formsemestre_bulletinetud_dict(
# log('cap details %s' % ue_status['moy']) # log('cap details %s' % ue_status['moy'])
if ue_status["moy"] != "NA" and ue_status["formsemestre_id"]: if ue_status["moy"] != "NA" and ue_status["formsemestre_id"]:
# detail des modules de l'UE capitalisee # detail des modules de l'UE capitalisee
nt_cap = context._getNotesCache().get_NotesTable( nt_cap = sco_core.get_notes_cache(context).get_NotesTable(
context, ue_status["formsemestre_id"] context, ue_status["formsemestre_id"]
) # > toutes notes ) # > toutes notes
@ -403,9 +403,11 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
(ajoute les informations aux modimpls) (ajoute les informations aux modimpls)
Result: liste de modules de l'UE avec les infos dans chacun (seulement ceux où l'étudiant est inscrit). 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 = sco_preferences.get_preference(
bul_show_abs_modules = sco_preferences.get_preference(context, context, "bul_show_mod_rangs", formsemestre_id
"bul_show_abs_modules", formsemestre_id )
bul_show_abs_modules = sco_preferences.get_preference(
context, "bul_show_abs_modules", formsemestre_id
) )
if bul_show_abs_modules: if bul_show_abs_modules:
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
@ -478,7 +480,9 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">' '<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">'
% (modimpl["moduleimpl_id"], mod["mod_descr_txt"]) % (modimpl["moduleimpl_id"], mod["mod_descr_txt"])
) )
if sco_preferences.get_preference(context, "bul_show_codemodules", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_codemodules", formsemestre_id
):
mod["code"] = modimpl["module"]["code"] mod["code"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code"] + "</a>" mod["code_html"] = link_mod + mod["code"] + "</a>"
else: else:
@ -497,7 +501,9 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">' '<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">'
% (modimpl["moduleimpl_id"], mod_descr) % (modimpl["moduleimpl_id"], mod_descr)
) )
if sco_preferences.get_preference(context, "bul_show_codemodules", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_codemodules", formsemestre_id
):
mod["code_txt"] = modimpl["module"]["code"] mod["code_txt"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code_txt"] + "</a>" mod["code_html"] = link_mod + mod["code_txt"] + "</a>"
else: else:
@ -558,7 +564,9 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
mod["evaluations_incompletes"] = [] mod["evaluations_incompletes"] = []
if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_all_evals", formsemestre_id
):
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
all_evals = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
@ -842,7 +850,9 @@ def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
return ( return (
sco_preferences.get_preference(context, "bul_mail_allowed_for_all", formsemestre_id) sco_preferences.get_preference(
context, "bul_mail_allowed_for_all", formsemestre_id
)
or authuser.has_permission(Permission.ScoImplement, context) or authuser.has_permission(Permission.ScoImplement, context)
or str(authuser) in sem["responsables"] or str(authuser) in sem["responsables"]
) )
@ -971,10 +981,18 @@ 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). If bul_mail_list_abs pref is true, put list of absences in mail body (text).
""" """
etud = I["etud"] etud = I["etud"]
webmaster = sco_preferences.get_preference(context, "bul_mail_contact_addr", formsemestre_id) webmaster = sco_preferences.get_preference(
dept = scu.unescape_html(sco_preferences.get_preference(context, "DeptName", formsemestre_id)) context, "bul_mail_contact_addr", 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) 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
)
if intro_mail: if intro_mail:
hea = intro_mail % { hea = intro_mail % {
@ -994,7 +1012,9 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
subj = Header("Relevé de notes de %s" % etud["nomprenom"], scu.SCO_ENCODING) subj = Header("Relevé de notes de %s" % etud["nomprenom"], scu.SCO_ENCODING)
recipients = [recipient_addr] recipients = [recipient_addr]
msg["Subject"] = subj msg["Subject"] = subj
msg["From"] = sco_preferences.get_preference(context, "email_from_addr", formsemestre_id) msg["From"] = sco_preferences.get_preference(
context, "email_from_addr", formsemestre_id
)
msg["To"] = " ,".join(recipients) msg["To"] = " ,".join(recipients)
if copy_addr: if copy_addr:
msg["Bcc"] = copy_addr.strip() msg["Bcc"] = copy_addr.strip()

View File

@ -147,7 +147,7 @@ def formsemestre_bulletinetud_published_dict(
context, pid context, pid
) )
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > toutes notes ) # > toutes notes
ues = nt.get_ues() ues = nt.get_ues()
@ -156,7 +156,8 @@ def formsemestre_bulletinetud_published_dict(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if ( if (
nt.get_moduleimpls_attente() nt.get_moduleimpls_attente()
or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0 or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id)
== 0
): ):
# n'affiche pas le rang sur le bulletin s'il y a des # n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre # notes en attente dans ce semestre
@ -209,7 +210,9 @@ def formsemestre_bulletinetud_published_dict(
value=scu.fmt_note(ue_status["cur_moy_ue"]), value=scu.fmt_note(ue_status["cur_moy_ue"]),
min=scu.fmt_note(ue["min"]), min=scu.fmt_note(ue["min"]),
max=scu.fmt_note(ue["max"]), max=scu.fmt_note(ue["max"]),
moy=scu.fmt_note(ue["moy"]), # CM : ajout pour faire apparaitre la moyenne des UE moy=scu.fmt_note(
ue["moy"]
), # CM : ajout pour faire apparaitre la moyenne des UE
), ),
rang=str(nt.ue_rangs[ue["ue_id"]][0][etudid]), rang=str(nt.ue_rangs[ue["ue_id"]][0][etudid]),
effectif=str(nt.ue_rangs[ue["ue_id"]][1]), effectif=str(nt.ue_rangs[ue["ue_id"]][1]),
@ -249,7 +252,9 @@ def formsemestre_bulletinetud_published_dict(
m["note"][k] = scu.fmt_note(m["note"][k]) m["note"][k] = scu.fmt_note(m["note"][k])
u["module"].append(m) u["module"].append(m)
if sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_mod_rangs", formsemestre_id
):
m["rang"] = dict( m["rang"] = dict(
value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid] value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]
) )
@ -276,14 +281,18 @@ def formsemestre_bulletinetud_published_dict(
), ),
coefficient=e["coefficient"], coefficient=e["coefficient"],
evaluation_type=e["evaluation_type"], evaluation_type=e["evaluation_type"],
evaluation_id=e["evaluation_id"], # CM : ajout pour permettre de faire le lien sur les bulletins en ligne avec l'évaluation evaluation_id=e[
"evaluation_id"
], # CM : ajout pour permettre de faire le lien sur les bulletins en ligne avec l'évaluation
description=scu.quote_xml_attr(e["description"]), description=scu.quote_xml_attr(e["description"]),
note=val, note=val,
) )
) )
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_all_evals", formsemestre_id
):
all_evals = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
@ -344,7 +353,9 @@ def formsemestre_bulletinetud_published_dict(
etudid, etudid,
formsemestre_id, formsemestre_id,
format="xml", format="xml",
show_uevalid=sco_preferences.get_preference(context, "bul_show_uevalid", formsemestre_id), show_uevalid=sco_preferences.get_preference(
context, "bul_show_uevalid", formsemestre_id
),
) )
d["situation"] = scu.quote_xml_attr(infos["situation"]) d["situation"] = scu.quote_xml_attr(infos["situation"])
if dpv: if dpv:

View File

@ -143,7 +143,7 @@ def process_field(
return text return text
# --- PDF format: # --- PDF format:
# handle logos: # handle logos:
image_dir = scu.SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/" image_dir = scu.SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/"
if not os.path.exists(image_dir): if not os.path.exists(image_dir):
image_dir = scu.SCODOC_LOGOS_DIR + "/" # use global logos image_dir = scu.SCODOC_LOGOS_DIR + "/" # use global logos
text = re.sub( text = re.sub(
@ -165,13 +165,15 @@ def get_formsemestre_bulletins_pdf(
context, formsemestre_id, REQUEST, version="selectedevals" context, formsemestre_id, REQUEST, version="selectedevals"
): ):
"document pdf et filename" "document pdf et filename"
cached = context._getNotesCache().get_bulletins_pdf(formsemestre_id, version) cached = sco_core.get_notes_cache(
context,
).get_bulletins_pdf(formsemestre_id, version)
if cached: if cached:
return cached[1], cached[0] return cached[1], cached[0]
fragments = [] fragments = []
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# Make each bulletin # Make each bulletin
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_sexnom ) # > get_etudids, get_sexnom
bookmarks = {} bookmarks = {}
@ -191,7 +193,9 @@ def get_formsemestre_bulletins_pdf(
bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid)) bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid))
i = i + 1 i = i + 1
# #
infos = {"DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)} infos = {
"DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)
}
if REQUEST: if REQUEST:
server_name = REQUEST.BASE0 server_name = REQUEST.BASE0
else: else:
@ -215,9 +219,9 @@ def get_formsemestre_bulletins_pdf(
filename = "bul-%s-%s.pdf" % (sem["titre_num"], dt) filename = "bul-%s-%s.pdf" % (sem["titre_num"], dt)
filename = scu.unescape_html(filename).replace(" ", "_").replace("&", "") filename = scu.unescape_html(filename).replace(" ", "_").replace("&", "")
# fill cache # fill cache
context._getNotesCache().store_bulletins_pdf( sco_core.get_notes_cache(
formsemestre_id, version, filename, pdfdoc context,
) ).store_bulletins_pdf(formsemestre_id, version, filename, pdfdoc)
return pdfdoc, filename return pdfdoc, filename

View File

@ -85,7 +85,7 @@ et sur page "réglages bulletin" (avec formsemestre_id)
# def _sig_filename(context, side, formsemestre_id=None): # def _sig_filename(context, side, formsemestre_id=None):
# if not side in ("left", "right"): # if not side in ("left", "right"):
# raise ValueError("side must be left or right") # raise ValueError("side must be left or right")
# dirs = [SCODOC_LOGOS_DIR, context.DeptId()] # dirs = [SCODOC_LOGOS_DIR, sco_core.get_dept_id()]
# if formsemestre_id: # if formsemestre_id:
# dirs.append(formsemestre_id) # dirs.append(formsemestre_id)
# dirs.append("bul_sig_{}".format(side)) # dirs.append("bul_sig_{}".format(side))

View File

@ -130,7 +130,7 @@ def make_xml_formsemestre_bulletinetud(
context, pid context, pid
) )
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > toutes notes ) # > toutes notes
ues = nt.get_ues() ues = nt.get_ues()
@ -139,7 +139,8 @@ def make_xml_formsemestre_bulletinetud(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if ( if (
nt.get_moduleimpls_attente() nt.get_moduleimpls_attente()
or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0 or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id)
== 0
): ):
# n'affiche pas le rang sur le bulletin s'il y a des # n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre # notes en attente dans ce semestre
@ -247,7 +248,9 @@ def make_xml_formsemestre_bulletinetud(
moy=scu.fmt_note(modstat["moy"]), moy=scu.fmt_note(modstat["moy"]),
) )
doc._pop() doc._pop()
if sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_mod_rangs", formsemestre_id
):
doc._push() doc._push()
doc.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]) doc.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid])
doc._pop() doc._pop()
@ -283,7 +286,9 @@ def make_xml_formsemestre_bulletinetud(
doc._pop() doc._pop()
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(
context, "bul_show_all_evals", formsemestre_id
):
all_evals = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
@ -353,7 +358,9 @@ def make_xml_formsemestre_bulletinetud(
etudid, etudid,
formsemestre_id, formsemestre_id,
format="xml", format="xml",
show_uevalid=sco_preferences.get_preference(context, "bul_show_uevalid", formsemestre_id), show_uevalid=sco_preferences.get_preference(
context, "bul_show_uevalid", formsemestre_id
),
) )
doc.situation(scu.quote_xml_attr(infos["situation"])) doc.situation(scu.quote_xml_attr(infos["situation"]))
if dpv: if dpv:

View File

@ -7,6 +7,9 @@
import types import types
import sco_utils as scu import sco_utils as scu
from notes_table import NOTES_CACHE_INST, CacheNotesTable
from scodoc_manager import sco_mgr
from sco_exceptions import ScoInvalidDept
def sco_get_version(context, REQUEST=None): def sco_get_version(context, REQUEST=None):
@ -17,10 +20,75 @@ def sco_get_version(context, REQUEST=None):
def test_refactor(context, x=1): def test_refactor(context, x=1):
x = context.toto() x = context.toto()
y = ("context=" + sco_edit_module.module_is_locked(context, "alpha")) + "23" y = ("context=" + sco_edit_module.module_is_locked(context, "alpha")) + "23"
z = html_sco_header.sco_header(context, z = html_sco_header.sco_header(
context,
a_long_argument_hahahahaha=1, a_long_argument_hahahahaha=1,
another_very_long_arggggggggggggg=2, another_very_long_arggggggggggggg=2,
z=6, z=6,
u=99, u=99,
kkkkkk=1, kkkkkk=1,
) )
def get_dept_id():
if g.scodoc_dept in sco_mgr.get_dept_ids():
return g.scodoc_dept
raise ScoInvalidDept("département invalide: %s" % g.scodoc_dept)
#
# Cache global: chaque instance, repérée par sa connexion db, a un cache
# qui est recréé à la demande
#
CACHE_formsemestre_inscription = {}
CACHE_evaluations = {}
# cache notes evaluations
def get_evaluations_cache(context):
"""returns cache for evaluations"""
u = context.GetDBConnexionString()
if CACHE_evaluations.has_key(u):
return CACHE_evaluations[u]
else:
log("get_evaluations_cache: new simpleCache")
CACHE_evaluations[u] = sco_cache.simpleCache()
return CACHE_evaluations[u]
def get_notes_cache(context):
"returns CacheNotesTable instance for us"
u = sco_mgr.get_db_uri() # identifie le dept de facon unique
if not NOTES_CACHE_INST.has_key(u):
log("getNotesCache: creating cache for %s" % u)
NOTES_CACHE_INST[u] = CacheNotesTable()
return NOTES_CACHE_INST[u]
def inval_cache(
context, formsemestre_id=None, pdfonly=False, formsemestre_id_list=None
): # >
"expire cache pour un semestre (ou tous si pas d'argument)"
if formsemestre_id_list:
for formsemestre_id in formsemestre_id_list:
get_notes_cache(context).inval_cache(
context, formsemestre_id=formsemestre_id, pdfonly=pdfonly
)
# Affecte aussi cache inscriptions
get_formsemestre_inscription_cache(context).inval_cache(key=formsemestre_id)
else:
get_notes_cache(context).inval_cache(
context, formsemestre_id=formsemestre_id, pdfonly=pdfonly
)
# Affecte aussi cache inscriptions
get_formsemestre_inscription_cache(context).inval_cache(key=formsemestre_id)
# Cache inscriptions semestres
def get_formsemestre_inscription_cache(context, format=None):
u = context.GetDBConnexionString()
if CACHE_formsemestre_inscription.has_key(u):
return CACHE_formsemestre_inscription[u]
else:
log("get_formsemestre_inscription_cache: new simpleCache")
CACHE_formsemestre_inscription[u] = sco_cache.simpleCache()
return CACHE_formsemestre_inscription[u]

View File

@ -110,9 +110,9 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
es = [(sems[i]["date_fin_iso"], i) for i in range(len(sems))] es = [(sems[i]["date_fin_iso"], i) for i in range(len(sems))]
imax = max(es)[1] imax = max(es)[1]
last_sem = sems[imax] last_sem = sems[imax]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(
context, last_sem["formsemestre_id"] context,
) ).get_NotesTable(context, last_sem["formsemestre_id"])
row = { row = {
"etudid": etudid, "etudid": etudid,
"civilite": etud["civilite"], "civilite": etud["civilite"],

View File

@ -46,7 +46,9 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
F = F[0] F = F[0]
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Suppression d'une formation"), html_sco_header.sco_header(
context, REQUEST, page_title="Suppression d'une formation"
),
"""<h2>Suppression de la formation %(titre)s (%(acronyme)s)</h2>""" % F, """<h2>Suppression de la formation %(titre)s (%(acronyme)s)</h2>""" % F,
] ]
@ -99,7 +101,9 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
"""Edit or create a formation""" """Edit or create a formation"""
if create: if create:
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Création d'une formation"), html_sco_header.sco_header(
context, REQUEST, page_title="Création d'une formation"
),
"""<h2>Création d'une formation</h2> """<h2>Création d'une formation</h2>
<p class="help">Une "formation" décrit une filière, comme un DUT ou une Licence. La formation se subdivise en unités pédagogiques (UE, matières, modules). Elle peut se diviser en plusieurs semestres (ou sessions), qui seront mis en place séparément. <p class="help">Une "formation" décrit une filière, comme un DUT ou une Licence. La formation se subdivise en unités pédagogiques (UE, matières, modules). Elle peut se diviser en plusieurs semestres (ou sessions), qui seront mis en place séparément.
@ -121,7 +125,9 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
is_locked = context.formation_has_locked_sems(formation_id) is_locked = context.formation_has_locked_sems(formation_id)
submitlabel = "Modifier les valeurs" submitlabel = "Modifier les valeurs"
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Modification d'une formation"), html_sco_header.sco_header(
context, REQUEST, page_title="Modification d'une formation"
),
"""<h2>Modification de la formation %(acronyme)s</h2>""" % initvalues, """<h2>Modification de la formation %(acronyme)s</h2>""" % initvalues,
] ]
if is_locked: if is_locked:
@ -271,6 +277,6 @@ def do_formation_edit(context, args):
for sem in sco_formsemestre.do_formsemestre_list( for sem in sco_formsemestre.do_formsemestre_list(
context, args={"formation_id": args["formation_id"]} context, args={"formation_id": args["formation_id"]}
): ):
context._inval_cache( sco_core.inval_cache(
formsemestre_id=sem["formsemestre_id"] context, formsemestre_id=sem["formsemestre_id"]
) # > formation modif. ) # > formation modif.

View File

@ -760,8 +760,8 @@ def do_ue_edit(context, args, bypass_lock=False, dont_invalidate_cache=False):
for sem in sco_formsemestre.do_formsemestre_list( for sem in sco_formsemestre.do_formsemestre_list(
context, args={"formation_id": ue["formation_id"]} context, args={"formation_id": ue["formation_id"]}
): ):
context._inval_cache( sco_core.inval_cache(
formsemestre_id=sem["formsemestre_id"] context, formsemestre_id=sem["formsemestre_id"]
) # > formation (ue) modif. ) # > formation (ue) modif.

View File

@ -104,7 +104,7 @@ def do_evaluation_delete(context, REQUEST, evaluation_id):
context._evaluationEditor.delete(cnx, evaluation_id) context._evaluationEditor.delete(cnx, evaluation_id)
# inval cache pour ce semestre # inval cache pour ce semestre
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
context._inval_cache(formsemestre_id=M["formsemestre_id"]) # > eval delete sco_core.inval_cache(context, formsemestre_id=M["formsemestre_id"]) # > eval delete
# news # news
mod = context.do_module_list(args={"module_id": M["module_id"]})[0] mod = context.do_module_list(args={"module_id": M["module_id"]})[0]
mod["moduleimpl_id"] = M["moduleimpl_id"] mod["moduleimpl_id"] = M["moduleimpl_id"]
@ -406,7 +406,7 @@ def _eval_etat(evals):
def do_evaluation_etat_in_sem(context, formsemestre_id, REQUEST=None): def do_evaluation_etat_in_sem(context, formsemestre_id, REQUEST=None):
"""-> nb_eval_completes, nb_evals_en_cours, nb_evals_vides, """-> nb_eval_completes, nb_evals_en_cours, nb_evals_vides,
date derniere modif, attente""" date derniere modif, attente"""
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > liste evaluations et moduleimpl en attente ) # > liste evaluations et moduleimpl en attente
evals = nt.get_sem_evaluation_etat_list() evals = nt.get_sem_evaluation_etat_list()
@ -429,7 +429,7 @@ def do_evaluation_etat_in_mod(context, nt, moduleimpl_id):
def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None): def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None):
"""Page avec calendrier de toutes les evaluations de ce semestre""" """Page avec calendrier de toutes les evaluations de ce semestre"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > liste evaluations ) # > liste evaluations
@ -565,7 +565,7 @@ def formsemestre_evaluations_delai_correction(
N'indique pas les évaluations de ratrapage ni celles des modules de bonus/malus. N'indique pas les évaluations de ratrapage ni celles des modules de bonus/malus.
""" """
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > liste evaluations ) # > liste evaluations

View File

@ -77,7 +77,7 @@ def _build_results_table(context, start_date=None, end_date=None, types_parcours
{} {}
) # etudid : { formsemestre_id d'inscription le plus recent dans les dates considérées, etud } ) # etudid : { formsemestre_id d'inscription le plus recent dans les dates considérées, etud }
for formsemestre_id in formsemestre_ids_parcours: for formsemestre_id in formsemestre_ids_parcours:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids ) # > get_etudids
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -198,7 +198,7 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
int(sem["annee_debut"]), sem["mois_debut_ord"] int(sem["annee_debut"]), sem["mois_debut_ord"]
) )
r["sid"] = "{} {} {}".format( r["sid"] = "{} {} {}".format(
sem["sem_id_txt"], context.DeptId(), sem["modalite"] sem["sem_id_txt"], sco_core.get_dept_id(), sem["modalite"]
) )
rows.append(r) rows.append(r)

View File

@ -226,7 +226,9 @@ def do_formsemestre_edit(context, sem, cnx=None, **kw):
write_formsemestre_etapes(context, sem) write_formsemestre_etapes(context, sem)
write_formsemestre_responsables(context, sem) write_formsemestre_responsables(context, sem)
context._inval_cache(formsemestre_id=sem["formsemestre_id"]) # > modif formsemestre sco_core.inval_cache(
context, formsemestre_id=sem["formsemestre_id"]
) # > modif formsemestre
def read_formsemestre_responsables(context, formsemestre_id): def read_formsemestre_responsables(context, formsemestre_id):

View File

@ -30,6 +30,7 @@
import notesdb as ndb import notesdb as ndb
import sco_utils as scu import sco_utils as scu
import sco_core
import sco_groups import sco_groups
from notes_log import log from notes_log import log
from TrivialFormulator import TrivialFormulator, TF from TrivialFormulator import TrivialFormulator, TF
@ -384,8 +385,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"size": 32, "size": 32,
"title": "Element(s) Apogée:", "title": "Element(s) Apogée:",
"explanation": "du semestre (ex: VRTW1). Séparés par des virgules.", "explanation": "du semestre (ex: VRTW1). Séparés par des virgules.",
"allow_null": not sco_preferences.get_preference(context, "allow_null": not sco_preferences.get_preference(
"always_require_apo_sem_codes" context, "always_require_apo_sem_codes"
), ),
}, },
) )
@ -397,8 +398,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"size": 32, "size": 32,
"title": "Element(s) Apogée:", "title": "Element(s) Apogée:",
"explanation": "de l'année (ex: VRT1A). Séparés par des virgules.", "explanation": "de l'année (ex: VRT1A). Séparés par des virgules.",
"allow_null": not sco_preferences.get_preference(context, "allow_null": not sco_preferences.get_preference(
"always_require_apo_sem_codes" context, "always_require_apo_sem_codes"
), ),
}, },
) )
@ -643,7 +644,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
# check dates # check dates
if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]): if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]):
msg = '<ul class="tf-msg"><li class="tf-msg">Dates de début et fin incompatibles !</li></ul>' msg = '<ul class="tf-msg"><li class="tf-msg">Dates de début et fin incompatibles !</li></ul>'
if sco_preferences.get_preference(context, "always_require_apo_sem_codes") and not any( if sco_preferences.get_preference(
context, "always_require_apo_sem_codes"
) and not any(
[tf[2]["etape_apo" + str(n)] for n in range(0, scu.EDIT_NB_ETAPES + 1)] [tf[2]["etape_apo" + str(n)] for n in range(0, scu.EDIT_NB_ETAPES + 1)]
): ):
msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>' msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>'
@ -1341,7 +1344,9 @@ def do_formsemestre_delete(context, formsemestre_id, REQUEST):
"DELETE FROM notes_evaluation WHERE evaluation_id=%(evaluation_id)s", "DELETE FROM notes_evaluation WHERE evaluation_id=%(evaluation_id)s",
e, e,
) )
context.get_evaluations_cache().inval_cache(key=e["evaluation_id"]) sco_core.get_evaluations_cache(
context,
).inval_cache(key=e["evaluation_id"])
sco_moduleimpl.do_moduleimpl_delete( sco_moduleimpl.do_moduleimpl_delete(
context, mod["moduleimpl_id"], formsemestre_id=formsemestre_id context, mod["moduleimpl_id"], formsemestre_id=formsemestre_id
@ -1638,8 +1643,8 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
z.append("</ul>") z.append("</ul>")
else: else:
z = ["""<h3>Aucune modification</h3>"""] z = ["""<h3>Aucune modification</h3>"""]
context._inval_cache( sco_core.inval_cache(
formsemestre_id=formsemestre_id context, formsemestre_id=formsemestre_id
) # > modif coef UE cap (modifs notes de _certains_ etudiants) ) # > modif coef UE cap (modifs notes de _certains_ etudiants)
header = html_sco_header.html_sem_header( header = html_sco_header.html_sem_header(
@ -1673,7 +1678,9 @@ def get_formsemestre_session_id(context, sem, F, parcours):
# F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0] # F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0]
# parcours = sco_codes_parcours.get_parcours_from_code(F['type_parcours']) # parcours = sco_codes_parcours.get_parcours_from_code(F['type_parcours'])
ImputationDept = sco_preferences.get_preference(context, "ImputationDept", sem["formsemestre_id"]) ImputationDept = sco_preferences.get_preference(
context, "ImputationDept", sem["formsemestre_id"]
)
if not ImputationDept: if not ImputationDept:
ImputationDept = sco_preferences.get_preference(context, "DeptName") ImputationDept = sco_preferences.get_preference(context, "DeptName")
ImputationDept = ImputationDept.upper() ImputationDept = ImputationDept.upper()

View File

@ -256,10 +256,13 @@ def formsemestre_ext_edit_ue_validations(
def _make_page(context, etud, sem, tf, message="", REQUEST=None): def _make_page(context, etud, sem, tf, message="", REQUEST=None):
nt = context._getNotesCache().get_NotesTable(context, sem["formsemestre_id"]) nt = sco_core.get_notes_cache(
context,
).get_NotesTable(context, sem["formsemestre_id"])
moy_gen = nt.get_etud_moy_gen(etud["etudid"]) moy_gen = nt.get_etud_moy_gen(etud["etudid"])
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Validation des UE d'un semestre extérieur", page_title="Validation des UE d'un semestre extérieur",
javascripts=["js/formsemestre_ext_edit_ue_validations.js"], javascripts=["js/formsemestre_ext_edit_ue_validations.js"],

View File

@ -120,7 +120,10 @@ def formsemestre_inscription_with_modules_form(
Si only_ext, ne montre que les semestre extérieurs. Si only_ext, ne montre que les semestre extérieurs.
""" """
etud = context.getEtudInfo(etudid=etudid, filled=1)[0] etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
H = [html_sco_header.sco_header(context, REQUEST), "<h2>Inscription de %s" % etud["nomprenom"]] H = [
html_sco_header.sco_header(context, REQUEST),
"<h2>Inscription de %s" % etud["nomprenom"],
]
if only_ext: if only_ext:
H.append(" dans un semestre extérieur") H.append(" dans un semestre extérieur")
H.append( H.append(
@ -177,8 +180,11 @@ def formsemestre_inscription_with_modules(
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
etud = context.getEtudInfo(etudid=etudid, filled=1)[0] etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Inscription de %s dans ce semestre" % etud["nomprenom"], sem context,
REQUEST,
"Inscription de %s dans ce semestre" % etud["nomprenom"],
sem,
) )
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer(context, REQUEST)
@ -273,7 +279,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
raise ScoValueError("Modification impossible: semestre verrouille") raise ScoValueError("Modification impossible: semestre verrouille")
etud = context.getEtudInfo(etudid=etudid, filled=1)[0] etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_ue_status ) # > get_etud_ue_status
@ -584,7 +590,7 @@ def list_inscrits_ailleurs(context, formsemestre_id):
Pour chacun, donne la liste des semestres. Pour chacun, donne la liste des semestres.
{ etudid : [ liste de sems ] } { etudid : [ liste de sems ] }
""" """
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids ) # > get_etudids
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -600,8 +606,11 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
""" """
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Inscriptions multiples parmi les étudiants du semestre ", sem context,
REQUEST,
"Inscriptions multiples parmi les étudiants du semestre ",
sem,
) )
] ]
insd = list_inscrits_ailleurs(context, formsemestre_id) insd = list_inscrits_ailleurs(context, formsemestre_id)

View File

@ -518,7 +518,9 @@ def fill_formsemestre(context, sem, REQUEST=None):
) )
else: else:
sem["locklink"] = "" sem["locklink"] = ""
if sco_preferences.get_preference(context, "bul_display_publication", formsemestre_id): if sco_preferences.get_preference(
context, "bul_display_publication", formsemestre_id
):
if sem["bul_hide_xml"] != "0": if sem["bul_hide_xml"] != "0":
eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés") eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés")
else: else:
@ -565,10 +567,12 @@ def formsemestre_description_table(
Liste des modules et de leurs coefficients Liste des modules et de leurs coefficients
""" """
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > liste evaluations ) # > liste evaluations
use_ue_coefs = sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id) use_ue_coefs = sco_preferences.get_preference(
context, "use_ue_coefs", formsemestre_id
)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"]) parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list(
@ -960,7 +964,9 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
), ),
"""<p><b style="font-size: 130%">Tableau de bord: </b><span class="help">cliquez sur un module pour saisir des notes</span></p>""", """<p><b style="font-size: 130%">Tableau de bord: </b><span class="help">cliquez sur un module pour saisir des notes</span></p>""",
] ]
nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) nt = sco_core.get_notes_cache(
context,
).get_NotesTable(context, formsemestre_id)
if nt.expr_diagnostics: if nt.expr_diagnostics:
H.append(html_expr_diagnostic(context, nt.expr_diagnostics)) H.append(html_expr_diagnostic(context, nt.expr_diagnostics))
H.append( H.append(

View File

@ -58,7 +58,7 @@ def formsemestre_validation_etud_form(
readonly=True, readonly=True,
REQUEST=None, REQUEST=None,
): ):
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_table_moyennes_triees, get_etud_decision_sem ) # > get_table_moyennes_triees, get_etud_decision_sem
T = nt.get_table_moyennes_triees() T = nt.get_table_moyennes_triees()
@ -97,7 +97,8 @@ def formsemestre_validation_etud_form(
raise ScoValueError("validation: semestre verrouille") raise ScoValueError("validation: semestre verrouille")
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Parcours %(nomprenom)s" % etud, page_title="Parcours %(nomprenom)s" % etud,
javascripts=["js/recap_parcours.js"], javascripts=["js/recap_parcours.js"],
@ -401,9 +402,9 @@ def formsemestre_validation_etud_manu(
def _redirect_valid_choice( def _redirect_valid_choice(
formsemestre_id, etudid, Se, choice, desturl, sortcol, REQUEST formsemestre_id, etudid, Se, choice, desturl, sortcol, REQUEST
): ):
adr = ( adr = "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1" % (
"formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1" formsemestre_id,
% (formsemestre_id, etudid) etudid,
) )
if sortcol: if sortcol:
adr += "&sortcol=" + sortcol adr += "&sortcol=" + sortcol
@ -522,7 +523,7 @@ def formsemestre_recap_parcours_table(
else: else:
ass = "" ass = ""
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, sem["formsemestre_id"] context, sem["formsemestre_id"]
) # > get_ues, get_etud_moy_gen, get_etud_ue_status ) # > get_ues, get_etud_moy_gen, get_etud_ue_status
if is_cur: if is_cur:
@ -656,7 +657,9 @@ def formsemestre_recap_parcours_table(
H.append("</tr>") H.append("</tr>")
# 3eme ligne: ECTS # 3eme ligne: ECTS
if ( if (
sco_preferences.get_preference(context, "bul_show_ects", sem["formsemestre_id"]) sco_preferences.get_preference(
context, "bul_show_ects", sem["formsemestre_id"]
)
or nt.parcours.ECTS_ONLY or nt.parcours.ECTS_ONLY
): ):
etud_moy_infos = nt.get_etud_moy_infos(etudid) etud_moy_infos = nt.get_etud_moy_infos(etudid)
@ -822,8 +825,8 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
"Formulaire saisie automatisee des decisions d'un semestre" "Formulaire saisie automatisee des decisions d'un semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Saisie automatique des décisions du semestre", sem context, REQUEST, "Saisie automatique des décisions du semestre", sem
), ),
""" """
<ul> <ul>
@ -852,7 +855,7 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
"Saisie automatisee des decisions d'un semestre" "Saisie automatisee des decisions d'un semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
next_semestre_id = sem["semestre_id"] + 1 next_semestre_id = sem["semestre_id"] + 1
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_etud_decision_sem, ) # > get_etudids, get_etud_decision_sem,
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -954,7 +957,7 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
N'affecte que le semestre indiqué, pas les précédents. N'affecte que le semestre indiqué, pas les précédents.
""" """
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_etud_decision_sem, get_ues, get_etud_decision_ues, get_etud_ue_status ) # > get_etudids, get_etud_decision_sem, get_ues, get_etud_decision_ues, get_etud_ue_status
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -1011,7 +1014,9 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
cnx.commit() cnx.commit()
# #
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Réparation des codes UE"), html_sco_header.sco_header(
context, REQUEST, page_title="Réparation des codes UE"
),
sco_formsemestre_status.formsemestre_status_head( sco_formsemestre_status.formsemestre_status_head(
context, REQUEST=REQUEST, formsemestre_id=formsemestre_id context, REQUEST=REQUEST, formsemestre_id=formsemestre_id
), ),
@ -1023,7 +1028,9 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
"</li><li>".join(modifs), "</li><li>".join(modifs),
"</li></ul>", "</li></ul>",
] ]
context._inval_cache(formsemestre_id=formsemestre_id) # > modif decision UE sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > modif decision UE
else: else:
H.append("<h2>Aucune modification: codes UE corrects ou inexistants</h2>") H.append("<h2>Aucune modification: codes UE corrects ou inexistants</h2>")
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer(context, REQUEST))
@ -1069,7 +1076,8 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
Fo = context.formation_list(args={"formation_id": sem["formation_id"]})[0] Fo = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Validation UE", page_title="Validation UE",
javascripts=["js/validate_previous_ue.js"], javascripts=["js/validate_previous_ue.js"],
@ -1160,7 +1168,13 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
<div id="ue_list_code"><!-- filled by ue_sharing_code --></div> <div id="ue_list_code"><!-- filled by ue_sharing_code --></div>
""" """
warn, ue_multiples = check_formation_ues(context, Fo["formation_id"]) warn, ue_multiples = check_formation_ues(context, Fo["formation_id"])
return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer(context, REQUEST) return (
"\n".join(H)
+ tf[1]
+ X
+ warn
+ html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
context.NotesURL() context.NotesURL()
@ -1207,7 +1221,7 @@ def do_formsemestre_validate_previous_ue(
""" """
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
cnx = context.GetDBConnexion(autocommit=False) cnx = context.GetDBConnexion(autocommit=False)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_ue_status ) # > get_etud_ue_status
if ue_coefficient != None: if ue_coefficient != None:
@ -1256,8 +1270,8 @@ def _invalidate_etud_formation_caches(context, etudid, formation_id):
{"etudid": etudid, "formation_id": formation_id}, {"etudid": etudid, "formation_id": formation_id},
) )
for fsid in [s["formsemestre_id"] for s in r]: for fsid in [s["formsemestre_id"] for s in r]:
context._inval_cache( sco_core.inval_cache(
formsemestre_id=fsid context, formsemestre_id=fsid
) # > modif decision UE (inval tous semestres avec cet etudiant, ok mais conservatif) ) # > modif decision UE (inval tous semestres avec cet etudiant, ok mais conservatif)

View File

@ -818,8 +818,11 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
) )
# #
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Partitions...", javascripts=["js/editPartitionForm.js"] context,
REQUEST,
page_title="Partitions...",
javascripts=["js/editPartitionForm.js"],
), ),
r"""<script type="text/javascript"> r"""<script type="text/javascript">
function checkname() { function checkname() {
@ -1207,7 +1210,9 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
] ]
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Répartition des groupes"), html_sco_header.sco_header(
context, REQUEST, page_title="Répartition des groupes"
),
"<h2>Répartition des groupes de %s</h2>" % partition["partition_name"], "<h2>Répartition des groupes de %s</h2>" % partition["partition_name"],
"<p>Semestre %s</p>" % sem["titreannee"], "<p>Semestre %s</p>" % sem["titreannee"],
"""<p class="help">Les groupes existants seront <b>effacés</b> et remplacés par """<p class="help">Les groupes existants seront <b>effacés</b> et remplacés par
@ -1227,7 +1232,9 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
name="tf", name="tf",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST) return (
"\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -1298,7 +1305,7 @@ def get_prev_moy(context, etudid, formsemestre_id):
etud = info[0] etud = info[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id) Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
if Se.prev: if Se.prev:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, Se.prev["formsemestre_id"] context, Se.prev["formsemestre_id"]
) # > get_etud_moy_gen ) # > get_etud_moy_gen
return nt.get_etud_moy_gen(etudid) return nt.get_etud_moy_gen(etudid)

View File

@ -645,7 +645,7 @@ def _add_moymod_column(
): ):
"""Ajoute la colonne moymod à rows""" """Ajoute la colonne moymod à rows"""
col_id = "moymod" col_id = "moymod"
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_mod_moy ) # > get_etud_mod_moy
nb_notes = 0 nb_notes = 0

View File

@ -64,8 +64,8 @@ def do_moduleimpl_create(context, args):
"create a moduleimpl" "create a moduleimpl"
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
r = _moduleimplEditor.create(cnx, args) r = _moduleimplEditor.create(cnx, args)
context._inval_cache( sco_core.inval_cache(
formsemestre_id=args["formsemestre_id"] context, formsemestre_id=args["formsemestre_id"]
) # > creation moduleimpl ) # > creation moduleimpl
return r return r
@ -91,7 +91,9 @@ def do_moduleimpl_delete(context, oid, formsemestre_id=None):
) )
# --- destruction du moduleimpl # --- destruction du moduleimpl
_moduleimplEditor.delete(cnx, oid) _moduleimplEditor.delete(cnx, oid)
context._inval_cache(formsemestre_id=formsemestre_id) # > moduleimpl_delete sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > moduleimpl_delete
def do_moduleimpl_list( def do_moduleimpl_list(
@ -113,7 +115,7 @@ def do_moduleimpl_edit(context, args, formsemestre_id=None, cnx=None):
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
_moduleimplEditor.edit(cnx, args) _moduleimplEditor.edit(cnx, args)
context._inval_cache(formsemestre_id=formsemestre_id) # > modif moduleimpl sco_core.inval_cache(context, formsemestre_id=formsemestre_id) # > modif moduleimpl
def do_moduleimpl_withmodule_list( def do_moduleimpl_withmodule_list(
@ -197,7 +199,9 @@ def do_moduleimpl_inscription_create(context, args, REQUEST=None, formsemestre_i
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
log("do_moduleimpl_inscription_create: " + str(args)) log("do_moduleimpl_inscription_create: " + str(args))
r = _moduleimpl_inscriptionEditor.create(cnx, args) r = _moduleimpl_inscriptionEditor.create(cnx, args)
context._inval_cache(formsemestre_id=formsemestre_id) # > moduleimpl_inscription sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > moduleimpl_inscription
if REQUEST: if REQUEST:
scolog.logdb( scolog.logdb(
REQUEST, REQUEST,
@ -214,7 +218,9 @@ def do_moduleimpl_inscription_delete(context, oid, formsemestre_id=None):
"delete moduleimpl_inscription" "delete moduleimpl_inscription"
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
_moduleimpl_inscriptionEditor.delete(cnx, oid) _moduleimpl_inscriptionEditor.delete(cnx, oid)
context._inval_cache(formsemestre_id=formsemestre_id) # > moduleimpl_inscription sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > moduleimpl_inscription
def do_moduleimpl_inscrit_etuds( def do_moduleimpl_inscrit_etuds(
@ -259,7 +265,9 @@ def do_moduleimpl_inscrit_etuds(
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
) )
context._inval_cache(formsemestre_id=formsemestre_id) # > moduleimpl_inscrit_etuds sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > moduleimpl_inscrit_etuds
def do_ens_list(context, *args, **kw): def do_ens_list(context, *args, **kw):

View File

@ -62,7 +62,8 @@ def moduleimpl_inscriptions_edit(
# -- check lock # -- check lock
if sem["etat"] != "1": if sem["etat"] != "1":
raise ScoValueError("opération impossible: semestre verrouille") raise ScoValueError("opération impossible: semestre verrouille")
header = html_sco_header.sco_header(context, header = html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Inscription au module", page_title="Inscription au module",
init_qtip=True, init_qtip=True,
@ -273,7 +274,11 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
mod["nb_inscrits"] = nb_inscrits mod["nb_inscrits"] = nb_inscrits
options.append(mod) options.append(mod)
# Page HTML: # Page HTML:
H = [html_sco_header.html_sem_header(context, REQUEST, "Inscriptions aux modules du semestre")] H = [
html_sco_header.html_sem_header(
context, REQUEST, "Inscriptions aux modules du semestre"
)
]
H.append("<h3>Inscrits au semestre: %d étudiants</h3>" % len(inscrits)) H.append("<h3>Inscrits au semestre: %d étudiants</h3>" % len(inscrits))
@ -458,7 +463,7 @@ def get_etuds_with_capitalized_ue(context, formsemestre_id):
returns { ue_id : [ { infos } ] } returns { ue_id : [ { infos } ] }
""" """
UECaps = scu.DictDefault(defaultvalue=[]) UECaps = scu.DictDefault(defaultvalue=[])
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_ues, get_etud_ue_status ) # > get_ues, get_etud_ue_status
inscrits = context.do_formsemestre_inscription_list( inscrits = context.do_formsemestre_inscription_list(
@ -532,8 +537,8 @@ def do_etud_desinscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None)
msg="desinscription UE %s" % ue_id, msg="desinscription UE %s" % ue_id,
commit=False, commit=False,
) )
context._inval_cache( sco_core.inval_cache(
formsemestre_id=formsemestre_id context, formsemestre_id=formsemestre_id
) # > desinscription etudiant des modules ) # > desinscription etudiant des modules

View File

@ -148,7 +148,9 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
context, moduleimpl_id=M["moduleimpl_id"] context, moduleimpl_id=M["moduleimpl_id"]
) )
nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) nt = sco_core.get_notes_cache(
context,
).get_NotesTable(context, formsemestre_id)
ModEvals = context.do_evaluation_list({"moduleimpl_id": moduleimpl_id}) ModEvals = context.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
ModEvals.sort( ModEvals.sort(
key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True
@ -162,7 +164,9 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST) arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST)
# #
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Module %(titre)s" % Mod), html_sco_header.sco_header(
context, REQUEST, page_title="Module %(titre)s" % Mod
),
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod, """<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
# XXX """caneditevals=%s caneditnotes=%s""" % (caneditevals,caneditnotes), # XXX """caneditevals=%s caneditnotes=%s""" % (caneditevals,caneditnotes),
"""<div class="moduleimpl_tableaubord"> """<div class="moduleimpl_tableaubord">

View File

@ -104,7 +104,7 @@ class DecisionSem:
def SituationEtudParcours(context, etud, formsemestre_id): def SituationEtudParcours(context, etud, formsemestre_id):
"""renvoie une instance de SituationEtudParcours (ou sous-classe spécialisée)""" """renvoie une instance de SituationEtudParcours (ou sous-classe spécialisée)"""
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_decision_sem, get_etud_moy_gen, get_ues, get_etud_ue_status, etud_check_conditions_ues ) # > get_etud_decision_sem, get_etud_moy_gen, get_ues, get_etud_ue_status, etud_check_conditions_ues
parcours = nt.parcours parcours = nt.parcours
@ -295,7 +295,7 @@ class SituationEtudParcoursGeneric:
sem["semestre_id"] == n1 sem["semestre_id"] == n1
and sem["formation_code"] == self.formation["formation_code"] and sem["formation_code"] == self.formation["formation_code"]
): ):
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) # > get_etud_decision_sem ) # > get_etud_decision_sem
decision = nt.get_etud_decision_sem(self.etudid) decision = nt.get_etud_decision_sem(self.etudid)
@ -311,7 +311,7 @@ class SituationEtudParcoursGeneric:
sont validés. En sortie, sem_idx_set contient ceux qui n'ont pas été validés.""" sont validés. En sortie, sem_idx_set contient ceux qui n'ont pas été validés."""
for sem in self.get_semestres(): for sem in self.get_semestres():
if sem["formation_code"] == self.formation["formation_code"]: if sem["formation_code"] == self.formation["formation_code"]:
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) # > get_etud_decision_sem ) # > get_etud_decision_sem
decision = nt.get_etud_decision_sem(self.etudid) decision = nt.get_etud_decision_sem(self.etudid)
@ -329,7 +329,7 @@ class SituationEtudParcoursGeneric:
ue_acros = {} # acronyme ue : 1 ue_acros = {} # acronyme ue : 1
nb_max_ue = 0 nb_max_ue = 0
for sem in sems: for sem in sems:
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) # > get_ues ) # > get_ues
ues = nt.get_ues(filter_sport=True) ues = nt.get_ues(filter_sport=True)
@ -399,7 +399,7 @@ class SituationEtudParcoursGeneric:
if not sem: if not sem:
code = "" # non inscrit à ce semestre code = "" # non inscrit à ce semestre
else: else:
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) # > get_etud_decision_sem ) # > get_etud_decision_sem
decision = nt.get_etud_decision_sem(self.etudid) decision = nt.get_etud_decision_sem(self.etudid)
@ -471,7 +471,7 @@ class SituationEtudParcoursGeneric:
# Verifications basiques: # Verifications basiques:
# ? # ?
# Code etat du semestre precedent: # Code etat du semestre precedent:
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, prev["formsemestre_id"] self.context, prev["formsemestre_id"]
) # > get_etud_decision_sem, get_etud_moy_gen, etud_check_conditions_ues ) # > get_etud_decision_sem, get_etud_moy_gen, etud_check_conditions_ues
self.prev_decision = nt.get_etud_decision_sem(self.etudid) self.prev_decision = nt.get_etud_decision_sem(self.etudid)
@ -530,7 +530,7 @@ class SituationEtudParcoursGeneric:
sem["formation_code"] == self.formation["formation_code"] sem["formation_code"] == self.formation["formation_code"]
and sem["semestre_id"] == s and sem["semestre_id"] == s
): ):
nt = self.context._getNotesCache().get_NotesTable( nt = self.sco_core.get_notes_cache(context).get_NotesTable(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) # > get_etud_decision_sem ) # > get_etud_decision_sem
decision = nt.get_etud_decision_sem(self.etudid) decision = nt.get_etud_decision_sem(self.etudid)
@ -629,8 +629,8 @@ class SituationEtudParcoursGeneric:
REQUEST=REQUEST, REQUEST=REQUEST,
) )
self.context._inval_cache( self.sco_core.inval_cache(
formsemestre_id=self.prev["formsemestre_id"] context, formsemestre_id=self.prev["formsemestre_id"]
) # > modif decisions jury (sem, UE) ) # > modif decisions jury (sem, UE)
# -- supprime autorisations venant de ce formsemestre # -- supprime autorisations venant de ce formsemestre
@ -659,17 +659,17 @@ class SituationEtudParcoursGeneric:
except: except:
cnx.rollback() cnx.rollback()
raise raise
self.context._inval_cache( self.sco_core.inval_cache(
formsemestre_id=self.formsemestre_id context, formsemestre_id=self.formsemestre_id
) # > modif decisions jury et autorisations inscription ) # > modif decisions jury et autorisations inscription
if decision.formsemestre_id_utilise_pour_compenser: if decision.formsemestre_id_utilise_pour_compenser:
# inval aussi le semestre utilisé pour compenser: # inval aussi le semestre utilisé pour compenser:
self.context._inval_cache( self.sco_core.inval_cache(
formsemestre_id=decision.formsemestre_id_utilise_pour_compenser context, formsemestre_id=decision.formsemestre_id_utilise_pour_compenser
) # > modif decision jury ) # > modif decision jury
for formsemestre_id in to_invalidate: for formsemestre_id in to_invalidate:
self.context._inval_cache( self.sco_core.inval_cache(
formsemestre_id=formsemestre_id context, formsemestre_id=formsemestre_id
) # > modif decision jury ) # > modif decision jury
@ -908,7 +908,7 @@ def formsemestre_validate_ues(
""" """
valid_semestre = CODES_SEM_VALIDES.get(code_etat_sem, False) valid_semestre = CODES_SEM_VALIDES.get(code_etat_sem, False)
cnx = context.GetDBConnexion(autocommit=False) cnx = context.GetDBConnexion(autocommit=False)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_ues, get_etud_ue_status ) # > get_ues, get_etud_ue_status
ue_ids = [x["ue_id"] for x in nt.get_ues(etudid=etudid, filter_sport=True)] ue_ids = [x["ue_id"] for x in nt.get_ues(etudid=etudid, filter_sport=True)]

View File

@ -200,7 +200,7 @@ class ScolarsPageTemplate(PageTemplate):
# XXX COPIED from sco_pvpdf, to be refactored (no time now) # XXX COPIED from sco_pvpdf, to be refactored (no time now)
# Search background in dept specific dir, then in global config dir # Search background in dept specific dir, then in global config dir
for image_dir in ( for image_dir in (
SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/", SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/",
SCODOC_LOGOS_DIR + "/", # global logos SCODOC_LOGOS_DIR + "/", # global logos
): ):
for suffix in LOGOS_IMAGES_ALLOWED_TYPES: for suffix in LOGOS_IMAGES_ALLOWED_TYPES:

View File

@ -315,7 +315,7 @@ def get_new_filename(context, etudid):
"""Constructs a random filename to store a new image. """Constructs a random filename to store a new image.
The path is constructed as: Fxx/etudid The path is constructed as: Fxx/etudid
""" """
dept = context.DeptId() dept = sco_core.get_dept_id()
return find_new_dir() + dept + "_" + etudid return find_new_dir() + dept + "_" + etudid

View File

@ -54,9 +54,9 @@ def etud_get_poursuite_info(context, sem, etud):
for s in etud["sems"]: for s in etud["sems"]:
if s["semestre_id"] == sem_id: if s["semestre_id"] == sem_id:
etudid = etud["etudid"] etudid = etud["etudid"]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(
context, s["formsemestre_id"] context,
) ).get_NotesTable(context, s["formsemestre_id"])
dec = nt.get_etud_decision_sem(etudid) dec = nt.get_etud_decision_sem(etudid)
# Moyennes et rangs des UE # Moyennes et rangs des UE
ues = nt.get_ues(filter_sport=True) ues = nt.get_ues(filter_sport=True)

View File

@ -44,7 +44,7 @@ import VERSION
def feuille_preparation_jury(context, formsemestre_id, REQUEST): def feuille_preparation_jury(context, formsemestre_id, REQUEST):
"Feuille excel pour preparation des jurys" "Feuille excel pour preparation des jurys"
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_etud_moy_gen, get_ues, get_etud_ue_status, get_etud_decision_sem, identdict, ) # > get_etudids, get_etud_moy_gen, get_ues, get_etud_ue_status, get_etud_decision_sem, identdict,
etudids = nt.get_etudids(sorted=True) # tri par moy gen etudids = nt.get_etudids(sorted=True) # tri par moy gen
@ -77,7 +77,7 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
etud = info[0] etud = info[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id) Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
if Se.prev: if Se.prev:
ntp = context._getNotesCache().get_NotesTable( ntp = sco_core.get_notes_cache(context).get_NotesTable(
context, Se.prev["formsemestre_id"] context, Se.prev["formsemestre_id"]
) # > get_ues, get_etud_ue_status, get_etud_moy_gen, get_etud_decision_sem ) # > get_ues, get_etud_ue_status, get_etud_moy_gen, get_etud_decision_sem
for ue in ntp.get_ues(filter_sport=True): for ue in ntp.get_ues(filter_sport=True):

View File

@ -210,7 +210,7 @@ def dict_pvjury(
'decisions_dict' : { etudid : decision (comme ci-dessus) }, 'decisions_dict' : { etudid : decision (comme ci-dessus) },
} }
""" """
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_etud_etat, get_etud_decision_sem, get_etud_decision_ues ) # > get_etudids, get_etud_etat, get_etud_decision_sem, get_etud_decision_ues
if etudids is None: if etudids is None:
@ -448,12 +448,14 @@ def pvjury_table(
} }
if with_paragraph_nom: if with_paragraph_nom:
cell_style = styles.ParagraphStyle({}) cell_style = styles.ParagraphStyle({})
cell_style.fontSize = sco_preferences.get_preference(context, cell_style.fontSize = sco_preferences.get_preference(
"SCOLAR_FONT_SIZE", formsemestre_id context, "SCOLAR_FONT_SIZE", formsemestre_id
) )
cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id) cell_style.fontName = sco_preferences.get_preference(
cell_style.leading = 1.0 * sco_preferences.get_preference(context, context, "PV_FONTNAME", formsemestre_id
"SCOLAR_FONT_SIZE", formsemestre_id )
cell_style.leading = 1.0 * sco_preferences.get_preference(
context, "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
i = e["identite"] i = e["identite"]
l["nomprenom"] = [ l["nomprenom"] = [

View File

@ -201,7 +201,7 @@ class CourrierIndividuelTemplate(PageTemplate):
self.logo_header = None self.logo_header = None
# Search logos in dept specific dir, then in global scu.CONFIG dir # Search logos in dept specific dir, then in global scu.CONFIG dir
for image_dir in ( for image_dir in (
scu.SCODOC_LOGOS_DIR + "/logos_" + context.DeptId() + "/", scu.SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/",
scu.SCODOC_LOGOS_DIR + "/", # global logos scu.SCODOC_LOGOS_DIR + "/", # global logos
): ):
for suffix in scu.LOGOS_IMAGES_ALLOWED_TYPES: for suffix in scu.LOGOS_IMAGES_ALLOWED_TYPES:
@ -358,7 +358,9 @@ def pdf_lettres_individuelles(
} }
# copie preferences # copie preferences
for name in sco_preferences.PREFS_NAMES: for name in sco_preferences.PREFS_NAMES:
params[name] = sco_preferences.get_preference(context, name, sem["formsemestre_id"]) params[name] = sco_preferences.get_preference(
context, name, sem["formsemestre_id"]
)
bookmarks = {} bookmarks = {}
objects = [] # list of PLATYPUS objects objects = [] # list of PLATYPUS objects
@ -429,7 +431,9 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
objects = [] objects = []
style = reportlab.lib.styles.ParagraphStyle({}) style = reportlab.lib.styles.ParagraphStyle({})
style.fontSize = 14 style.fontSize = 14
style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id) style.fontName = sco_preferences.get_preference(
context, "PV_FONTNAME", formsemestre_id
)
style.leading = 18 style.leading = 18
style.alignment = TA_JUSTIFY style.alignment = TA_JUSTIFY
@ -443,8 +447,8 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
else: else:
params["decisions_ue_descr_plural"] = "" params["decisions_ue_descr_plural"] = ""
params["INSTITUTION_CITY"] = sco_preferences.get_preference(context, params["INSTITUTION_CITY"] = sco_preferences.get_preference(
"INSTITUTION_CITY", formsemestre_id context, "INSTITUTION_CITY", formsemestre_id
) )
if decision["prev_decision_sem"]: if decision["prev_decision_sem"]:
params["prev_semestre_id"] = decision["prev"]["semestre_id"] params["prev_semestre_id"] = decision["prev"]["semestre_id"]
@ -512,7 +516,9 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
# Corps de la lettre: # Corps de la lettre:
objects += sco_bulletins_pdf.process_field( objects += sco_bulletins_pdf.process_field(
context, context,
sco_preferences.get_preference(context, "PV_LETTER_TEMPLATE", sem["formsemestre_id"]), sco_preferences.get_preference(
context, "PV_LETTER_TEMPLATE", sem["formsemestre_id"]
),
params, params,
style, style,
suppress_empty_pars=True, suppress_empty_pars=True,
@ -523,7 +529,9 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
# chef de département. # chef de département.
if Se.semestre_non_terminal: if Se.semestre_non_terminal:
sig = ( sig = (
sco_preferences.get_preference(context, "PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id) sco_preferences.get_preference(
context, "PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id
)
% params % params
) )
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">') sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
@ -538,7 +546,9 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
) )
else: else:
sig = ( sig = (
sco_preferences.get_preference(context, "PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id) sco_preferences.get_preference(
context, "PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id
)
% params % params
) )
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">') sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
@ -580,13 +590,17 @@ def _make_signature_image(signature, leftindent, formsemestre_id, context=None):
im = PILImage.open(f) im = PILImage.open(f)
width, height = im.size width, height = im.size
pdfheight = ( pdfheight = (
1.0 * sco_preferences.get_preference(context, "pv_sig_image_height", formsemestre_id) * mm 1.0
* sco_preferences.get_preference(
context, "pv_sig_image_height", formsemestre_id
)
* mm
) )
f.seek(0, 0) f.seek(0, 0)
style = styles.ParagraphStyle({}) style = styles.ParagraphStyle({})
style.leading = 1.0 * sco_preferences.get_preference(context, style.leading = 1.0 * sco_preferences.get_preference(
"SCOLAR_FONT_SIZE", formsemestre_id context, "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
style.leftIndent = leftindent style.leftIndent = leftindent
return Table( return Table(
@ -702,14 +716,18 @@ def _pvjury_pdf_type(
style = reportlab.lib.styles.ParagraphStyle({}) style = reportlab.lib.styles.ParagraphStyle({})
style.fontSize = 12 style.fontSize = 12
style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id) style.fontName = sco_preferences.get_preference(
context, "PV_FONTNAME", formsemestre_id
)
style.leading = 18 style.leading = 18
style.alignment = TA_JUSTIFY style.alignment = TA_JUSTIFY
indent = 1 * cm indent = 1 * cm
bulletStyle = reportlab.lib.styles.ParagraphStyle({}) bulletStyle = reportlab.lib.styles.ParagraphStyle({})
bulletStyle.fontSize = 12 bulletStyle.fontSize = 12
bulletStyle.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id) bulletStyle.fontName = sco_preferences.get_preference(
context, "PV_FONTNAME", formsemestre_id
)
bulletStyle.leading = 12 bulletStyle.leading = 12
bulletStyle.alignment = TA_JUSTIFY bulletStyle.alignment = TA_JUSTIFY
bulletStyle.firstLineIndent = 0 bulletStyle.firstLineIndent = 0
@ -761,7 +779,9 @@ def _pvjury_pdf_type(
% { % {
"Decnum": numeroArrete, "Decnum": numeroArrete,
"VDICode": VDICode, "VDICode": VDICode,
"UnivName": sco_preferences.get_preference(context, "UnivName", formsemestre_id), "UnivName": sco_preferences.get_preference(
context, "UnivName", formsemestre_id
),
"Type": titre_jury, "Type": titre_jury,
"Date": date_commission, # deprecated "Date": date_commission, # deprecated
"date_commission": date_commission, "date_commission": date_commission,
@ -787,10 +807,14 @@ def _pvjury_pdf_type(
titles = [titles.get(x, "") for x in columns_ids] titles = [titles.get(x, "") for x in columns_ids]
# Make a new cell style and put all cells in paragraphs # Make a new cell style and put all cells in paragraphs
cell_style = styles.ParagraphStyle({}) cell_style = styles.ParagraphStyle({})
cell_style.fontSize = sco_preferences.get_preference(context, "SCOLAR_FONT_SIZE", formsemestre_id) cell_style.fontSize = sco_preferences.get_preference(
cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id) context, "SCOLAR_FONT_SIZE", formsemestre_id
cell_style.leading = 1.0 * sco_preferences.get_preference(context, )
"SCOLAR_FONT_SIZE", formsemestre_id cell_style.fontName = sco_preferences.get_preference(
context, "PV_FONTNAME", formsemestre_id
)
cell_style.leading = 1.0 * sco_preferences.get_preference(
context, "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
LINEWIDTH = 0.5 LINEWIDTH = 0.5
table_style = [ table_style = [
@ -826,8 +850,10 @@ def _pvjury_pdf_type(
"""<para spaceBefore="10mm" align="right"> """<para spaceBefore="10mm" align="right">
%s, %s</para>""" %s, %s</para>"""
% ( % (
sco_preferences.get_preference(context, "DirectorName", formsemestre_id) or "", sco_preferences.get_preference(context, "DirectorName", formsemestre_id)
sco_preferences.get_preference(context, "DirectorTitle", formsemestre_id) or "", or "",
sco_preferences.get_preference(context, "DirectorTitle", formsemestre_id)
or "",
), ),
style, style,
) )

View File

@ -75,7 +75,9 @@ def formsemestre_recapcomplet(
) # cache les colonnes des modules ) # cache les colonnes des modules
pref_override = int(pref_override) pref_override = int(pref_override)
if pref_override: if pref_override:
hidebac = int(sco_preferences.get_preference(context, "recap_hidebac", formsemestre_id)) hidebac = int(
sco_preferences.get_preference(context, "recap_hidebac", formsemestre_id)
)
else: else:
hidebac = int(hidebac) hidebac = int(hidebac)
xml_with_decisions = int(xml_with_decisions) xml_with_decisions = int(xml_with_decisions)
@ -84,7 +86,8 @@ def formsemestre_recapcomplet(
H = [] H = []
if not isFile: if not isFile:
H += [ H += [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Récapitulatif", page_title="Récapitulatif",
no_side_bar=True, no_side_bar=True,
@ -271,7 +274,7 @@ def make_formsemestre_recapcomplet(
sem = sco_formsemestre.do_formsemestre_list( sem = sco_formsemestre.do_formsemestre_list(
context, args={"formsemestre_id": formsemestre_id} context, args={"formsemestre_id": formsemestre_id}
)[0] )[0]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_modimpls, get_ues, get_table_moyennes_triees, get_etud_decision_sem, get_etud_etat, get_etud_rang, get_nom_short, get_mod_stats, nt.moy_moy, get_etud_decision_sem, ) # > get_modimpls, get_ues, get_table_moyennes_triees, get_etud_decision_sem, get_etud_etat, get_etud_rang, get_nom_short, get_mod_stats, nt.moy_moy, get_etud_decision_sem,
modimpls = nt.get_modimpls() modimpls = nt.get_modimpls()
@ -486,7 +489,9 @@ def make_formsemestre_recapcomplet(
if key == "nb_valid_evals": if key == "nb_valid_evals":
l.append("") l.append("")
elif key == "coef": elif key == "coef":
if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id): if sco_preferences.get_preference(
context, "use_ue_coefs", formsemestre_id
):
l.append("%2.3f" % ue["coefficient"]) l.append("%2.3f" % ue["coefficient"])
else: else:
l.append("") l.append("")
@ -853,7 +858,7 @@ def _formsemestre_recapcomplet_xml(
): ):
"XML export: liste tous les bulletins XML." "XML export: liste tous les bulletins XML."
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_table_moyennes_triees ) # > get_table_moyennes_triees
T = nt.get_table_moyennes_triees() T = nt.get_table_moyennes_triees()
@ -920,7 +925,7 @@ def _formsemestre_recapcomplet_json(
"bulletins": [], "bulletins": [],
} }
bulletins = J["bulletins"] bulletins = J["bulletins"]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_table_moyennes_triees ) # > get_table_moyennes_triees
T = nt.get_table_moyennes_triees() T = nt.get_table_moyennes_triees()

View File

@ -55,7 +55,7 @@ MAX_ETUD_IN_DESCR = 20
def formsemestre_etuds_stats(context, sem, only_primo=False): def formsemestre_etuds_stats(context, sem, only_primo=False):
"""Récupère liste d'etudiants avec etat et decision.""" """Récupère liste d'etudiants avec etat et decision."""
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, sem["formsemestre_id"] context, sem["formsemestre_id"]
) # > get_table_moyennes_triees, identdict, get_etud_decision_sem, get_etud_etat, ) # > get_table_moyennes_triees, identdict, get_etud_decision_sem, get_etud_etat,
T = nt.get_table_moyennes_triees() T = nt.get_table_moyennes_triees()
@ -404,7 +404,7 @@ def table_suivi_cohorte(
logt("table_suivi_cohorte: start") logt("table_suivi_cohorte: start")
# 1-- Liste des semestres posterieurs dans lesquels ont été les etudiants de sem # 1-- Liste des semestres posterieurs dans lesquels ont été les etudiants de sem
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, get_etud_decision_sem ) # > get_etudids, get_etud_decision_sem
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -458,7 +458,7 @@ def table_suivi_cohorte(
s["members"] = orig_set.intersection(inset) s["members"] = orig_set.intersection(inset)
nb_dipl = 0 # combien de diplomes dans ce semestre ? nb_dipl = 0 # combien de diplomes dans ce semestre ?
if s["semestre_id"] == nt.parcours.NB_SEM: if s["semestre_id"] == nt.parcours.NB_SEM:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, s["formsemestre_id"] context, s["formsemestre_id"]
) # > get_etud_decision_sem ) # > get_etud_decision_sem
for etudid in s["members"]: for etudid in s["members"]:
@ -908,7 +908,7 @@ def _descr_etud_set(context, etudids):
def _count_dem_reo(context, formsemestre_id, etudids): def _count_dem_reo(context, formsemestre_id, etudids):
"count nb of demissions and reorientation in this etud set" "count nb of demissions and reorientation in this etud set"
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_etat, get_etud_decision_sem ) # > get_etud_etat, get_etud_decision_sem
dems = set() dems = set()
@ -974,7 +974,7 @@ def get_codeparcoursetud(context, etud, prefix="", separator=""):
i = len(sems) - 1 i = len(sems) - 1
while i >= 0: while i >= 0:
s = sems[i] # 'sems' est a l'envers, du plus recent au plus ancien s = sems[i] # 'sems' est a l'envers, du plus recent au plus ancien
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, s["formsemestre_id"] context, s["formsemestre_id"]
) # > get_etud_etat, get_etud_decision_sem ) # > get_etud_etat, get_etud_decision_sem
p.append(_codesem(s, prefix=prefix)) p.append(_codesem(s, prefix=prefix))
@ -1021,7 +1021,7 @@ def tsp_etud_list(
""" """
# log('tsp_etud_list(%s, bac="%s")' % (formsemestre_id,bac)) # log('tsp_etud_list(%s, bac="%s")' % (formsemestre_id,bac))
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids, ) # > get_etudids,
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -1273,7 +1273,7 @@ def graph_parcours(
nxt = {} nxt = {}
etudid = etud["etudid"] etudid = etud["etudid"]
for s in etud["sems"]: # du plus recent au plus ancien for s in etud["sems"]: # du plus recent au plus ancien
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, s["formsemestre_id"] context, s["formsemestre_id"]
) # > get_etud_decision_sem, get_etud_etat ) # > get_etud_decision_sem, get_etud_etat
dec = nt.get_etud_decision_sem(etudid) dec = nt.get_etud_decision_sem(etudid)

View File

@ -44,6 +44,7 @@ from sco_exceptions import (
ScoValueError, ScoValueError,
) )
from sco_permissions import ScoEditAllNotes from sco_permissions import ScoEditAllNotes
import sco_core
import sco_formsemestre import sco_formsemestre
import sco_moduleimpl import sco_moduleimpl
import sco_groups import sco_groups
@ -458,7 +459,11 @@ def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=F
url=mod["url"], url=mod["url"],
) )
return html_sco_header.sco_header(context, REQUEST) + "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return (
html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST)
)
def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True): def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
@ -577,15 +582,19 @@ def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
log("*** exception in _notes_add") log("*** exception in _notes_add")
if do_it: if do_it:
# inval cache # inval cache
context._inval_cache( sco_core.inval_cache(
formsemestre_id=M["formsemestre_id"] context, formsemestre_id=M["formsemestre_id"]
) # > modif notes (exception) ) # > modif notes (exception)
cnx.rollback() # abort cnx.rollback() # abort
raise # re-raise exception raise # re-raise exception
if do_it: if do_it:
cnx.commit() cnx.commit()
context._inval_cache(formsemestre_id=M["formsemestre_id"]) # > modif notes sco_core.inval_cache(
context.get_evaluations_cache().inval_cache(key=evaluation_id) context, formsemestre_id=M["formsemestre_id"]
) # > modif notes
sco_core.get_evaluations_cache(
context,
).inval_cache(key=evaluation_id)
return nb_changed, nb_suppress, existing_decisions return nb_changed, nb_suppress, existing_decisions
@ -627,7 +636,8 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
) )
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=page_title, page_title=page_title,
javascripts=sco_groups_view.JAVASCRIPTS, javascripts=sco_groups_view.JAVASCRIPTS,
@ -845,7 +855,7 @@ def has_existing_decision(context, M, E, etudid):
Si oui, return True Si oui, return True
""" """
formsemestre_id = M["formsemestre_id"] formsemestre_id = M["formsemestre_id"]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_decision_sem, get_etud_decision_ues ) # > get_etud_decision_sem, get_etud_decision_ues
if nt.get_etud_decision_sem(etudid): if nt.get_etud_decision_sem(etudid):
@ -908,7 +918,8 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
# HTML page: # HTML page:
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=page_title, page_title=page_title,
javascripts=sco_groups_view.JAVASCRIPTS + ["js/saisie_notes.js"], javascripts=sco_groups_view.JAVASCRIPTS + ["js/saisie_notes.js"],

View File

@ -229,9 +229,9 @@ class SemSet(dict):
self["etuds_without_nip"] = set() # etudids self["etuds_without_nip"] = set() # etudids
self["jury_ok"] = True self["jury_ok"] = True
for sem in self.sems: for sem in self.sems:
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(
context, sem["formsemestre_id"] context,
) ).get_NotesTable(context, sem["formsemestre_id"])
sem["etuds"] = nt.identdict.values() sem["etuds"] = nt.identdict.values()
sem["nips"] = {e["code_nip"] for e in sem["etuds"] if e["code_nip"]} sem["nips"] = {e["code_nip"] for e in sem["etuds"] if e["code_nip"]}
sem["etuds_without_nip"] = { sem["etuds_without_nip"] = {

View File

@ -105,7 +105,9 @@ def formsemestre_synchro_etuds(
""" """
% sem % sem
) )
header = html_sco_header.sco_header(context, REQUEST, page_title="Synchronisation étudiants") header = html_sco_header.sco_header(
context, REQUEST, page_title="Synchronisation étudiants"
)
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer(context, REQUEST)
base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
if anneeapogee: if anneeapogee:
@ -667,7 +669,8 @@ def do_import_etuds_from_portal(context, sem, a_importer, etudsapo_ident, REQUES
) )
cnx.commit() cnx.commit()
log("do_import_etuds_from_portal: re-raising exception") log("do_import_etuds_from_portal: re-raising exception")
context._inval_cache() # > import: modif identite, adresses, inscriptions # > import: modif identite, adresses, inscriptions
sco_core.inval_cache(context)
raise raise
sco_news.add( sco_news.add(
@ -846,7 +849,7 @@ def formsemestre_import_etud_admission(
changed_mails.append((info, etud["mail"])) changed_mails.append((info, etud["mail"]))
else: else:
unknowns.append(code_nip) unknowns.append(code_nip)
context._inval_cache(formsemestre_id=sem["formsemestre_id"]) sco_core.inval_cache(context, formsemestre_id=sem["formsemestre_id"])
return no_nip, unknowns, changed_mails return no_nip, unknowns, changed_mails

View File

@ -273,7 +273,9 @@ def get_etud_tagged_modules(context, etudid, tagname):
etud = context.getEtudInfo(etudid=etudid, filled=True)[0] etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
R = [] R = []
for sem in etud["sems"]: for sem in etud["sems"]:
nt = context._getNotesCache().get_NotesTable(context, sem["formsemestre_id"]) nt = sco_core.get_notes_cache(
context,
).get_NotesTable(context, sem["formsemestre_id"])
modimpls = nt.get_modimpls() modimpls = nt.get_modimpls()
for modimpl in modimpls: for modimpl in modimpls:
tags = module_tag_list(context, module_id=modimpl["module_id"]) tags = module_tag_list(context, module_id=modimpl["module_id"])
@ -341,5 +343,5 @@ sem = etud['sems'][0]
[ tm['moy'] for tm in get_etud_tagged_modules(context, etudid, 'allo') ] [ tm['moy'] for tm in get_etud_tagged_modules(context, etudid, 'allo') ]
# si besoin après modif par le Web: # si besoin après modif par le Web:
# context._inval_cache() # sco_core.inval_cache(context)
""" """

View File

@ -52,6 +52,7 @@ import sco_utils as scu
import notesdb as ndb import notesdb as ndb
from notes_log import log from notes_log import log
from gen_tables import GenTable from gen_tables import GenTable
import sco_core
import sco_formsemestre import sco_formsemestre
import sco_moduleimpl import sco_moduleimpl
import VERSION import VERSION
@ -95,7 +96,7 @@ class NotesOperation(dict):
# # il y a-t-il une modif plus recente ? # # il y a-t-il une modif plus recente ?
# if self['current_notes_by_etud']['date'] <= self['date'] + OPERATION_DATE_TOLERANCE: # if self['current_notes_by_etud']['date'] <= self['date'] + OPERATION_DATE_TOLERANCE:
# #
# + invalider cache context.get_evaluations_cache().inval_cache(key=evaluation_id) # + invalider cache sco_core.get_evaluations_cache(context, ).inval_cache(key=evaluation_id)
def list_operations(context, evaluation_id): def list_operations(context, evaluation_id):

View File

@ -385,7 +385,9 @@ def identite_edit(cnx, args, context=None, REQUEST=None):
notify_to = None notify_to = None
if context: if context:
try: try:
notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to") notify_to = sco_preferences.get_preference(
context, "notify_etud_changes_to"
)
except: except:
pass pass
@ -498,7 +500,9 @@ def adresse_edit(cnx, args, context=None):
notify_to = None notify_to = None
if context: if context:
try: try:
notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to") notify_to = sco_preferences.get_preference(
context, "notify_etud_changes_to"
)
except: except:
pass pass
if notify_to: if notify_to:
@ -890,7 +894,7 @@ def fillEtudsInfo(context, etuds):
# open('/tmp/t','w').write( str(etuds) ) # open('/tmp/t','w').write( str(etuds) )
for etud in etuds: for etud in etuds:
etudid = etud["etudid"] etudid = etud["etudid"]
etud["dept"] = context.DeptId() etud["dept"] = sco_core.get_dept_id()
adrs = adresse_list(cnx, {"etudid": etudid}) adrs = adresse_list(cnx, {"etudid": etudid})
if not adrs: if not adrs:
# certains "vieux" etudiants n'ont pas d'adresse # certains "vieux" etudiants n'ont pas d'adresse

View File

@ -68,13 +68,12 @@ from app.scodoc.sco_exceptions import (
AccessDenied, AccessDenied,
) )
from app.scodoc.sco_pdf import PDFLOCK from app.scodoc.sco_pdf import PDFLOCK
from app.scodoc.notes_table import NOTES_CACHE_INST, CacheNotesTable
import app.scodoc.VERSION as VERSION import app.scodoc.VERSION as VERSION
from app.scodoc.sco_news import NEWS_INSCR, NEWS_NOTE, NEWS_FORM, NEWS_SEM, NEWS_MISC from app.scodoc.sco_news import NEWS_INSCR, NEWS_NOTE, NEWS_FORM, NEWS_SEM, NEWS_MISC
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable
from app.scodoc.sco_permissions import Permission, ScoImplement from app.scodoc.sco_permissions import Permission, ScoImplement
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
from app.scodoc import sco_core
from app.scodoc import htmlutils from app.scodoc import htmlutils
from app.scodoc import notes_table from app.scodoc import notes_table
from app.scodoc import pe_view from app.scodoc import pe_view
@ -163,42 +162,8 @@ sco_publish("/essai2", essai2, Permission.ScoImplement)
# --------------------- # ---------------------
#
# Cache global: chaque instance, repérée par sa connexion db, a un cache
# qui est recréé à la demande
#
CACHE_formsemestre_inscription = {}
CACHE_evaluations = {}
# --------------- # ---------------
def _getNotesCache(context):
"returns CacheNotesTable instance for us"
u = sco_mgr.get_db_uri() # identifie le dept de facon unique
if not NOTES_CACHE_INST.has_key(u):
log("getNotesCache: creating cache for %s" % u)
NOTES_CACHE_INST[u] = CacheNotesTable()
return NOTES_CACHE_INST[u]
def _inval_cache(
context, formsemestre_id=None, pdfonly=False, formsemestre_id_list=None
): # >
"expire cache pour un semestre (ou tous si pas d'argument)"
if formsemestre_id_list:
for formsemestre_id in formsemestre_id_list:
context._getNotesCache().inval_cache(
context, formsemestre_id=formsemestre_id, pdfonly=pdfonly
)
# Affecte aussi cache inscriptions
context.get_formsemestre_inscription_cache().inval_cache(
key=formsemestre_id
)
else:
context._getNotesCache().inval_cache(
context, formsemestre_id=formsemestre_id, pdfonly=pdfonly
)
# Affecte aussi cache inscriptions
context.get_formsemestre_inscription_cache().inval_cache(key=formsemestre_id)
@bp.route("/clearcache") @bp.route("/clearcache")
@ -210,7 +175,7 @@ def clearcache(context, REQUEST=None):
# Debugging code: compare results before and after cache reconstruction # Debugging code: compare results before and after cache reconstruction
# (_should_ be identicals !) # (_should_ be identicals !)
# Compare XML representation # Compare XML representation
cache = context._getNotesCache() cache = sco_core.get_notes_cache(context)
formsemestre_ids = cache.get_cached_formsemestre_ids() formsemestre_ids = cache.get_cached_formsemestre_ids()
docs_before = [] docs_before = []
for formsemestre_id in formsemestre_ids: for formsemestre_id in formsemestre_ids:
@ -686,7 +651,8 @@ def _do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=
) )
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
context._ueEditor.delete(cnx, ue_id) context._ueEditor.delete(cnx, ue_id)
context._inval_cache() # > UE delete + supr. validations associées etudiants (cas compliqué, mais rarement utilisé: acceptable de tout invalider ?) # > UE delete + supr. validations associées etudiants (cas compliqué, mais rarement utilisé: acceptable de tout invalider ?):
sco_core.inval_cache(context)
# news # news
F = context.formation_list(args={"formation_id": ue["formation_id"]})[0] F = context.formation_list(args={"formation_id": ue["formation_id"]})[0]
sco_news.add( sco_news.add(
@ -801,7 +767,7 @@ def do_matiere_edit(context, *args, **kw):
raise ScoLockedFormError() raise ScoLockedFormError()
# edit # edit
context._matiereEditor.edit(cnx, *args, **kw) context._matiereEditor.edit(cnx, *args, **kw)
context._inval_cache() # > modif matiere sco_core.inval_cache(context) # > modif matiere
@bp.route("/do_matiere_formation_id") @bp.route("/do_matiere_formation_id")
@ -941,8 +907,8 @@ def do_module_edit(context, val):
context, args={"formation_id": mod["formation_id"]} context, args={"formation_id": mod["formation_id"]}
) )
if sems: if sems:
context._inval_cache( sco_core.inval_cache(
formsemestre_id_list=[s["formsemestre_id"] for s in sems] context, formsemestre_id_list=[s["formsemestre_id"] for s in sems]
) # > modif module ) # > modif module
@ -1498,8 +1464,8 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
}, },
formsemestre_id=sem["formsemestre_id"], formsemestre_id=sem["formsemestre_id"],
) )
context._inval_cache( sco_core.inval_cache(
formsemestre_id=sem["formsemestre_id"] context, formsemestre_id=sem["formsemestre_id"]
) # > modif regle calcul ) # > modif regle calcul
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"moduleimpl_status?moduleimpl_id=" "moduleimpl_status?moduleimpl_id="
@ -1649,7 +1615,9 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
else: else:
sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, tf[2]) sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, tf[2])
context._inval_cache(formsemestre_id=formsemestre_id) # > modif regle calcul sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > modif regle calcul
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=" "formsemestre_status?formsemestre_id="
+ formsemestre_id + formsemestre_id
@ -1808,8 +1776,8 @@ def do_formsemestre_inscription_create(context, args, REQUEST, method=None):
commit=False, commit=False,
) )
# #
context._inval_cache( sco_core.inval_cache(
formsemestre_id=args["formsemestre_id"] context, formsemestre_id=args["formsemestre_id"]
) # > inscription au semestre ) # > inscription au semestre
return r return r
@ -1822,8 +1790,8 @@ def do_formsemestre_inscription_delete(context, oid, formsemestre_id=None):
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
context._formsemestre_inscriptionEditor.delete(cnx, oid) context._formsemestre_inscriptionEditor.delete(cnx, oid)
context._inval_cache( sco_core.inval_cache(
formsemestre_id=formsemestre_id context, formsemestre_id=formsemestre_id
) # > desinscription du semestre ) # > desinscription du semestre
@ -1843,7 +1811,7 @@ def do_formsemestre_inscription_listinscrits(
context, formsemestre_id, format=None, REQUEST=None context, formsemestre_id, format=None, REQUEST=None
): ):
"""Liste les inscrits (état I) à ce semestre et cache le résultat""" """Liste les inscrits (état I) à ce semestre et cache le résultat"""
cache = context.get_formsemestre_inscription_cache() cache = sco_core.get_formsemestre_inscription_cache(context, )
r = cache.get(formsemestre_id) r = cache.get(formsemestre_id)
if r is None: if r is None:
# retreive list # retreive list
@ -1861,8 +1829,8 @@ def do_formsemestre_inscription_edit(context, args=None, formsemestre_id=None):
"edit a formsemestre_inscription" "edit a formsemestre_inscription"
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
context._formsemestre_inscriptionEditor.edit(cnx, args) context._formsemestre_inscriptionEditor.edit(cnx, args)
context._inval_cache( sco_core.inval_cache(
formsemestre_id=formsemestre_id context, formsemestre_id=formsemestre_id
) # > modif inscription semestre (demission ?) ) # > modif inscription semestre (demission ?)
@ -1894,7 +1862,7 @@ def formsemestre_desinscription(
raise ScoValueError("desinscription impossible: semestre verrouille") raise ScoValueError("desinscription impossible: semestre verrouille")
# -- Si décisions de jury, désinscription interdite # -- Si décisions de jury, désinscription interdite
nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
if nt.etud_has_decision(etudid): if nt.etud_has_decision(etudid):
raise ScoValueError( raise ScoValueError(
"""Désinscription impossible: l'étudiant a une décision de jury """Désinscription impossible: l'étudiant a une décision de jury
@ -1969,7 +1937,7 @@ def do_formsemestre_desinscription(context, etudid, formsemestre_id, REQUEST=Non
raise ScoValueError("desinscription impossible: semestre verrouille") raise ScoValueError("desinscription impossible: semestre verrouille")
# -- Si decisions de jury, desinscription interdite # -- Si decisions de jury, desinscription interdite
nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
if nt.etud_has_decision(etudid): if nt.etud_has_decision(etudid):
raise ScoValueError( raise ScoValueError(
"desinscription impossible: l'étudiant a une décision de jury (la supprimer avant si nécessaire)" "desinscription impossible: l'étudiant a une décision de jury (la supprimer avant si nécessaire)"
@ -2453,8 +2421,8 @@ def do_evaluation_edit(context, REQUEST, args):
context._evaluationEditor.edit(cnx, args) context._evaluationEditor.edit(cnx, args)
# inval cache pour ce semestre # inval cache pour ce semestre
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
context._inval_cache( sco_core.inval_cache(
formsemestre_id=M["formsemestre_id"] context, formsemestre_id=M["formsemestre_id"]
) # > evaluation_edit (coef, ...) ) # > evaluation_edit (coef, ...)
@ -2552,17 +2520,6 @@ sco_publish(
) )
# cache notes evaluations
def get_evaluations_cache(context):
u = context.GetDBConnexionString()
if CACHE_evaluations.has_key(u):
return CACHE_evaluations[u]
else:
log("get_evaluations_cache: new simpleCache")
CACHE_evaluations[u] = sco_cache.simpleCache()
return CACHE_evaluations[u]
def _notes_getall( def _notes_getall(
context, evaluation_id, table="notes_notes", filter_suppressed=True, by_uid=None context, evaluation_id, table="notes_notes", filter_suppressed=True, by_uid=None
): ):
@ -2574,7 +2531,7 @@ def _notes_getall(
filter_suppressed and table == "notes_notes" and (by_uid is None) filter_suppressed and table == "notes_notes" and (by_uid is None)
) # pas de cache pour (rares) appels via undo_notes ou specifiant un enseignant ) # pas de cache pour (rares) appels via undo_notes ou specifiant un enseignant
if do_cache: if do_cache:
cache = context.get_evaluations_cache() cache = sco_core.get_evaluations_cache(context)
r = cache.get(evaluation_id) r = cache.get(evaluation_id)
if r != None: if r != None:
return r return r
@ -2652,7 +2609,7 @@ def formsemestre_bulletins_mailetuds(
): ):
"envoi a chaque etudiant (inscrit et ayant un mail) son bulletin" "envoi a chaque etudiant (inscrit et ayant un mail) son bulletin"
prefer_mail_perso = int(prefer_mail_perso) prefer_mail_perso = int(prefer_mail_perso)
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etudids ) # > get_etudids
etudids = nt.get_etudids() etudids = nt.get_etudids()
@ -2809,8 +2766,8 @@ def appreciation_add_form(
msg=tf[2]["comment"], msg=tf[2]["comment"],
) )
# ennuyeux mais necessaire (pour le PDF seulement) # ennuyeux mais necessaire (pour le PDF seulement)
context._inval_cache( sco_core.inval_cache(
pdfonly=True, formsemestre_id=formsemestre_id context, pdfonly=True, formsemestre_id=formsemestre_id
) # > appreciation_add ) # > appreciation_add
return REQUEST.RESPONSE.redirect(bull_url) return REQUEST.RESPONSE.redirect(bull_url)
@ -3096,7 +3053,7 @@ def formsemestre_validation_suppress_etud(
if not dialog_confirmed: if not dialog_confirmed:
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
etud = context.getEtudInfo(etudid=etudid, filled=1)[0] etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
nt = context._getNotesCache().get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > get_etud_decision_sem ) # > get_etud_decision_sem
decision_jury = nt.get_etud_decision_sem(etudid) decision_jury = nt.get_etud_decision_sem(etudid)

View File

@ -164,13 +164,6 @@ log("ScoDoc8 restarting...")
# #
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# ? à déplacer ?
def DeptId():
if g.scodoc_dept in sco_mgr.get_dept_ids():
return g.scodoc_dept
raise ScoInvalidDept("département invalide: %s" % g.scodoc_dept)
# sco_publish( # sco_publish(
# "/formsemestre_evaluations_delai_correction", # "/formsemestre_evaluations_delai_correction",
# sco_evaluations.formsemestre_evaluations_delai_correction, # sco_evaluations.formsemestre_evaluations_delai_correction,
@ -304,7 +297,9 @@ def rssnews(context, REQUEST=None):
"rss feed" "rss feed"
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE) REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
return sco_news.scolar_news_summary_rss( return sco_news.scolar_news_summary_rss(
context, "Nouvelles de " + sco_preferences.get_preference(context, "DeptName"), context.ScoURL() context,
"Nouvelles de " + sco_preferences.get_preference(context, "DeptName"),
context.ScoURL(),
) )