From 23477faa3b8da462859a9df7951ddcc5191c4f70 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 13 Jun 2021 23:37:14 +0200 Subject: [PATCH] WIP refactoring: caches --- app/scodoc/ImportScolars.py | 2 +- app/scodoc/debug.py | 6 +- app/scodoc/notes_table.py | 16 ++-- app/scodoc/sco_apogee_csv.py | 34 +++---- app/scodoc/sco_archives.py | 16 ++-- app/scodoc/sco_bulletins.py | 48 +++++++--- app/scodoc/sco_bulletins_json.py | 25 ++++-- app/scodoc/sco_bulletins_pdf.py | 18 ++-- app/scodoc/sco_bulletins_signature.py | 2 +- app/scodoc/sco_bulletins_xml.py | 17 ++-- app/scodoc/sco_core.py | 70 ++++++++++++++- app/scodoc/sco_debouche.py | 6 +- app/scodoc/sco_edit_formation.py | 16 ++-- app/scodoc/sco_edit_ue.py | 4 +- app/scodoc/sco_evaluations.py | 8 +- app/scodoc/sco_export_results.py | 4 +- app/scodoc/sco_formsemestre.py | 4 +- app/scodoc/sco_formsemestre_edit.py | 25 ++++-- app/scodoc/sco_formsemestre_exterieurs.py | 7 +- app/scodoc/sco_formsemestre_inscriptions.py | 23 +++-- app/scodoc/sco_formsemestre_status.py | 14 ++- app/scodoc/sco_formsemestre_validation.py | 50 +++++++---- app/scodoc/sco_groups.py | 17 ++-- app/scodoc/sco_liste_notes.py | 2 +- app/scodoc/sco_moduleimpl.py | 22 +++-- app/scodoc/sco_moduleimpl_inscriptions.py | 15 ++-- app/scodoc/sco_moduleimpl_status.py | 8 +- app/scodoc/sco_parcours_dut.py | 32 +++---- app/scodoc/sco_pdf.py | 2 +- app/scodoc/sco_photos.py | 2 +- app/scodoc/sco_poursuite_dut.py | 6 +- app/scodoc/sco_prepajury.py | 4 +- app/scodoc/sco_pvjury.py | 14 +-- app/scodoc/sco_pvpdf.py | 66 +++++++++----- app/scodoc/sco_recapcomplet.py | 17 ++-- app/scodoc/sco_report.py | 14 +-- app/scodoc/sco_saisie_notes.py | 27 ++++-- app/scodoc/sco_semset.py | 6 +- app/scodoc/sco_synchro_etuds.py | 9 +- app/scodoc/sco_tag_module.py | 6 +- app/scodoc/sco_undo_notes.py | 3 +- app/scodoc/scolars.py | 10 ++- app/views/notes.py | 99 ++++++--------------- app/views/scolar.py | 11 +-- 44 files changed, 504 insertions(+), 303 deletions(-) diff --git a/app/scodoc/ImportScolars.py b/app/scodoc/ImportScolars.py index 701ede72..92a3d447 100644 --- a/app/scodoc/ImportScolars.py +++ b/app/scodoc/ImportScolars.py @@ -698,7 +698,7 @@ def scolars_import_admission( nline += 1 diag.append("%d lignes importées" % n_import) if n_import > 0: - context._inval_cache(formsemestre_id=formsemestre_id) + sco_core.inval_cache(context, formsemestre_id=formsemestre_id) return diag diff --git a/app/scodoc/debug.py b/app/scodoc/debug.py index 676f3039..c1e9f6c7 100644 --- a/app/scodoc/debug.py +++ b/app/scodoc/debug.py @@ -60,7 +60,7 @@ import sco_bulletins_xml def go(app, n=0, verbose=True): context = app.ScoDoc.objectValues("Folder")[n].Scolarite if verbose: - print("context in dept ", context.DeptId()) + print("context in dept ", sco_core.get_dept_id()) return context @@ -72,9 +72,9 @@ def go_dept(app, dept, verbose=True): except AttributeError: # ignore other folders, like old "icons" continue - if context.DeptId() == dept: + if sco_core.get_dept_id() == dept: if verbose: - print("context in dept ", context.DeptId()) + print("context in dept ", sco_core.get_dept_id()) return context raise ValueError("dep %s not found" % dept) diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index 1eadd2db..f0e00a60 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -32,7 +32,7 @@ import time import pdb import inspect - +import sco_core import scolars import sco_groups from notes_log import log, logCallStack @@ -173,7 +173,9 @@ class NotesTable: self.moduleimpl_stats = {} # { moduleimpl_id : {stats} } self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap 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 self.inscrlist = context.do_formsemestre_inscription_list( 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)" % (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"] ) # > UE capitalisees par un etud moy_ue_cap = nt_cap.get_etud_ue_status(etudid, ue_cap["ue_id"])[ @@ -1421,7 +1423,9 @@ class CacheNotesTable: self.cache = {} self.pdfcache = {} self._call_all_listeners() - context.get_evaluations_cache().inval_cache() + sco_core.get_evaluations_cache( + context, + ).inval_cache() else: # formsemestre_id modifié: # on doit virer formsemestre_id et tous les semestres @@ -1438,7 +1442,9 @@ class CacheNotesTable: ) del self.cache[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 ( diff --git a/app/scodoc/sco_apogee_csv.py b/app/scodoc/sco_apogee_csv.py index 55ccc145..619f6462 100644 --- a/app/scodoc/sco_apogee_csv.py +++ b/app/scodoc/sco_apogee_csv.py @@ -379,7 +379,9 @@ class ApoEtud(dict): dict: with N, B, J, R keys, ou None si elt non trouvé """ 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: return None # etudiant non inscrit dans ce semestre @@ -487,9 +489,9 @@ class ApoEtud(dict): # l'étudiant n'a pas de semestre courant ?! log("comp_elt_annuel: %s no cur_sem" % etudid) return VOID_APO_RES - cur_nt = context._getNotesCache().get_NotesTable( - context, cur_sem["formsemestre_id"] - ) + cur_nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, cur_sem["formsemestre_id"]) cur_decision = cur_nt.get_etud_decision_sem(etudid) if not cur_decision: # pas de decision => pas de résultat annuel @@ -506,9 +508,9 @@ class ApoEtud(dict): decision_apo = code_scodoc_to_apo(cur_decision["code"]) - autre_nt = context._getNotesCache().get_NotesTable( - context, autre_sem["formsemestre_id"] - ) + autre_nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, autre_sem["formsemestre_id"]) autre_decision = autre_nt.get_etud_decision_sem(etudid) if not autre_decision: # pas de decision dans l'autre => pas de résultat annuel @@ -571,9 +573,9 @@ class ApoEtud(dict): # prend le plus recent avec decision cur_sem = None for sem in cur_sems: - nt = context._getNotesCache().get_NotesTable( - context, sem["formsemestre_id"] - ) + nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, sem["formsemestre_id"]) decision = nt.get_etud_decision_sem(self.etud["etudid"]) if decision: cur_sem = sem @@ -633,9 +635,9 @@ class ApoEtud(dict): else: autre_sem = None for sem in autres_sems: - nt = context._getNotesCache().get_NotesTable( - context, sem["formsemestre_id"] - ) + nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, sem["formsemestre_id"]) decision = nt.get_etud_decision_sem(self.etud["etudid"]) if decision: autre_sem = sem @@ -968,9 +970,9 @@ class ApoData: s.add(code) continue # associé à une UE: - nt = self.context._getNotesCache().get_NotesTable( - self.context, sem["formsemestre_id"] - ) + nt = self.sco_core.get_notes_cache( + context, + ).get_NotesTable(self.context, sem["formsemestre_id"]) for ue in nt.get_ues(): if ue["code_apogee"] == code: s.add(code) diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index c9f1953b..c8abbe8a 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -93,7 +93,7 @@ class BaseArchiver: :return: path to directory of archives for this object (eg formsemestre_id or etudid). 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: scu.GSL.acquire() if not os.path.isdir(dept_dir): @@ -111,7 +111,7 @@ class BaseArchiver: """ :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 + "*") return [os.path.split(x)[1] for x in dirs] @@ -299,7 +299,8 @@ def do_formsemestre_archive( if data: data = "\n".join( [ - html_sco_header.sco_header(context, + html_sco_header.sco_header( + context, REQUEST, page_title="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 = [ - html_sco_header.html_sem_header(context, + html_sco_header.html_sem_header( + context, REQUEST, "Archiver les PV et résultats du semestre", sem=sem, @@ -503,7 +505,11 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id): L.append(a) 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: H.append("

aucune archive enregistrée

") else: diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index a9dfa74a..43f8b89e 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -117,7 +117,7 @@ def formsemestre_bulletinetud_dict( raise ValueError("invalid version code !") prefs = sco_preferences.SemPreferences(context, formsemestre_id) - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > toutes notes @@ -337,7 +337,7 @@ def formsemestre_bulletinetud_dict( # log('cap details %s' % ue_status['moy']) if ue_status["moy"] != "NA" and ue_status["formsemestre_id"]: # 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"] ) # > toutes notes @@ -403,9 +403,11 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers (ajoute les informations aux modimpls) 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_abs_modules = sco_preferences.get_preference(context, - "bul_show_abs_modules", formsemestre_id + bul_show_mod_rangs = sco_preferences.get_preference( + context, "bul_show_mod_rangs", formsemestre_id + ) + bul_show_abs_modules = sco_preferences.get_preference( + context, "bul_show_abs_modules", formsemestre_id ) if bul_show_abs_modules: 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 '' % (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_html"] = link_mod + mod["code"] + "" else: @@ -497,7 +501,9 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers '' % (modimpl["moduleimpl_id"], mod_descr) ) - if sco_preferences.get_preference(context, "bul_show_codemodules", formsemestre_id): + if sco_preferences.get_preference( + context, "bul_show_codemodules", formsemestre_id + ): mod["code_txt"] = modimpl["module"]["code"] mod["code_html"] = link_mod + mod["code_txt"] + "" else: @@ -558,7 +564,9 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers # Evaluations incomplètes ou futures: mod["evaluations_incompletes"] = [] - if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): + if sco_preferences.get_preference( + context, "bul_show_all_evals", formsemestre_id + ): complete_eval_ids = set([e["evaluation_id"] for e in evals]) all_evals = context.do_evaluation_list( args={"moduleimpl_id": modimpl["moduleimpl_id"]} @@ -842,7 +850,9 @@ def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST): authuser = REQUEST.AUTHENTICATED_USER sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) return ( - sco_preferences.get_preference(context, "bul_mail_allowed_for_all", formsemestre_id) + sco_preferences.get_preference( + context, "bul_mail_allowed_for_all", formsemestre_id + ) or authuser.has_permission(Permission.ScoImplement, context) 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). """ etud = I["etud"] - webmaster = sco_preferences.get_preference(context, "bul_mail_contact_addr", formsemestre_id) - dept = scu.unescape_html(sco_preferences.get_preference(context, "DeptName", formsemestre_id)) - copy_addr = sco_preferences.get_preference(context, "email_copy_bulletins", formsemestre_id) - intro_mail = sco_preferences.get_preference(context, "bul_intro_mail", formsemestre_id) + webmaster = sco_preferences.get_preference( + context, "bul_mail_contact_addr", formsemestre_id + ) + dept = scu.unescape_html( + sco_preferences.get_preference(context, "DeptName", formsemestre_id) + ) + copy_addr = sco_preferences.get_preference( + context, "email_copy_bulletins", formsemestre_id + ) + intro_mail = sco_preferences.get_preference( + context, "bul_intro_mail", formsemestre_id + ) if 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) recipients = [recipient_addr] 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) if copy_addr: msg["Bcc"] = copy_addr.strip() diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index 360150c8..157367eb 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -147,7 +147,7 @@ def formsemestre_bulletinetud_published_dict( context, pid ) - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > toutes notes ues = nt.get_ues() @@ -156,7 +156,8 @@ def formsemestre_bulletinetud_published_dict( mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) if ( nt.get_moduleimpls_attente() - or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0 + or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) + == 0 ): # n'affiche pas le rang sur le bulletin s'il y a des # notes en attente dans ce semestre @@ -209,7 +210,9 @@ def formsemestre_bulletinetud_published_dict( value=scu.fmt_note(ue_status["cur_moy_ue"]), min=scu.fmt_note(ue["min"]), 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]), 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]) 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( value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid] ) @@ -276,14 +281,18 @@ def formsemestre_bulletinetud_published_dict( ), coefficient=e["coefficient"], 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"]), note=val, ) ) # Evaluations incomplètes ou futures: complete_eval_ids = set([e["evaluation_id"] for e in evals]) - if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): + if sco_preferences.get_preference( + context, "bul_show_all_evals", formsemestre_id + ): all_evals = context.do_evaluation_list( args={"moduleimpl_id": modimpl["moduleimpl_id"]} ) @@ -344,7 +353,9 @@ def formsemestre_bulletinetud_published_dict( etudid, formsemestre_id, 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"]) if dpv: diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py index fa8e337d..a3e05029 100644 --- a/app/scodoc/sco_bulletins_pdf.py +++ b/app/scodoc/sco_bulletins_pdf.py @@ -143,7 +143,7 @@ def process_field( return text # --- PDF format: # 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): image_dir = scu.SCODOC_LOGOS_DIR + "/" # use global logos text = re.sub( @@ -165,13 +165,15 @@ def get_formsemestre_bulletins_pdf( context, formsemestre_id, REQUEST, version="selectedevals" ): "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: return cached[1], cached[0] fragments = [] sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # Make each bulletin - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > get_etudids, get_sexnom bookmarks = {} @@ -191,7 +193,9 @@ def get_formsemestre_bulletins_pdf( bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid)) i = i + 1 # - infos = {"DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)} + infos = { + "DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id) + } if REQUEST: server_name = REQUEST.BASE0 else: @@ -215,9 +219,9 @@ def get_formsemestre_bulletins_pdf( filename = "bul-%s-%s.pdf" % (sem["titre_num"], dt) filename = scu.unescape_html(filename).replace(" ", "_").replace("&", "") # fill cache - context._getNotesCache().store_bulletins_pdf( - formsemestre_id, version, filename, pdfdoc - ) + sco_core.get_notes_cache( + context, + ).store_bulletins_pdf(formsemestre_id, version, filename, pdfdoc) return pdfdoc, filename diff --git a/app/scodoc/sco_bulletins_signature.py b/app/scodoc/sco_bulletins_signature.py index ade30e2e..32cdd998 100644 --- a/app/scodoc/sco_bulletins_signature.py +++ b/app/scodoc/sco_bulletins_signature.py @@ -85,7 +85,7 @@ et sur page "réglages bulletin" (avec formsemestre_id) # def _sig_filename(context, side, formsemestre_id=None): # if not side in ("left", "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: # dirs.append(formsemestre_id) # dirs.append("bul_sig_{}".format(side)) diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py index 1eb9be31..782ca98c 100644 --- a/app/scodoc/sco_bulletins_xml.py +++ b/app/scodoc/sco_bulletins_xml.py @@ -130,7 +130,7 @@ def make_xml_formsemestre_bulletinetud( context, pid ) - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > toutes notes ues = nt.get_ues() @@ -139,7 +139,8 @@ def make_xml_formsemestre_bulletinetud( mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) if ( nt.get_moduleimpls_attente() - or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0 + or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) + == 0 ): # n'affiche pas le rang sur le bulletin s'il y a des # notes en attente dans ce semestre @@ -247,7 +248,9 @@ def make_xml_formsemestre_bulletinetud( moy=scu.fmt_note(modstat["moy"]), ) 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.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]) doc._pop() @@ -283,7 +286,9 @@ def make_xml_formsemestre_bulletinetud( doc._pop() # Evaluations incomplètes ou futures: complete_eval_ids = set([e["evaluation_id"] for e in evals]) - if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id): + if sco_preferences.get_preference( + context, "bul_show_all_evals", formsemestre_id + ): all_evals = context.do_evaluation_list( args={"moduleimpl_id": modimpl["moduleimpl_id"]} ) @@ -353,7 +358,9 @@ def make_xml_formsemestre_bulletinetud( etudid, formsemestre_id, 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"])) if dpv: diff --git a/app/scodoc/sco_core.py b/app/scodoc/sco_core.py index 963a3c1e..6f12a338 100644 --- a/app/scodoc/sco_core.py +++ b/app/scodoc/sco_core.py @@ -7,6 +7,9 @@ import types 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): @@ -17,10 +20,75 @@ def sco_get_version(context, REQUEST=None): def test_refactor(context, x=1): x = context.toto() 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, another_very_long_arggggggggggggg=2, z=6, u=99, 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] \ No newline at end of file diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index 143b629a..9262af3d 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -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))] imax = max(es)[1] last_sem = sems[imax] - nt = context._getNotesCache().get_NotesTable( - context, last_sem["formsemestre_id"] - ) + nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, last_sem["formsemestre_id"]) row = { "etudid": etudid, "civilite": etud["civilite"], diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index 6f237d21..ec9ccb39 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -46,7 +46,9 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST F = F[0] 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" + ), """

Suppression de la formation %(titre)s (%(acronyme)s)

""" % F, ] @@ -99,7 +101,9 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): """Edit or create a formation""" if create: 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" + ), """

Création d'une formation

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) submitlabel = "Modifier les valeurs" 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" + ), """

Modification de la formation %(acronyme)s

""" % initvalues, ] if is_locked: @@ -271,6 +277,6 @@ def do_formation_edit(context, args): for sem in sco_formsemestre.do_formsemestre_list( context, args={"formation_id": args["formation_id"]} ): - context._inval_cache( - formsemestre_id=sem["formsemestre_id"] + sco_core.inval_cache( + context, formsemestre_id=sem["formsemestre_id"] ) # > formation modif. diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 5be47eb0..9f784ec9 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -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( context, args={"formation_id": ue["formation_id"]} ): - context._inval_cache( - formsemestre_id=sem["formsemestre_id"] + sco_core.inval_cache( + context, formsemestre_id=sem["formsemestre_id"] ) # > formation (ue) modif. diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index 9a82bfa3..bce63b6b 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -104,7 +104,7 @@ def do_evaluation_delete(context, REQUEST, evaluation_id): context._evaluationEditor.delete(cnx, evaluation_id) # inval cache pour ce semestre 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 mod = context.do_module_list(args={"module_id": M["module_id"]})[0] 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): """-> nb_eval_completes, nb_evals_en_cours, nb_evals_vides, date derniere modif, attente""" - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > liste evaluations et moduleimpl en attente 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): """Page avec calendrier de toutes les evaluations de ce semestre""" 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 ) # > 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. """ 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 ) # > liste evaluations diff --git a/app/scodoc/sco_export_results.py b/app/scodoc/sco_export_results.py index b9a6ec1f..0afe3f81 100644 --- a/app/scodoc/sco_export_results.py +++ b/app/scodoc/sco_export_results.py @@ -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 } for formsemestre_id in formsemestre_ids_parcours: - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > 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"] ) 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) diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index cc4aaf63..ba8b5270 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -226,7 +226,9 @@ def do_formsemestre_edit(context, sem, cnx=None, **kw): write_formsemestre_etapes(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): diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 4e295f8e..bfeda7b4 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -30,6 +30,7 @@ import notesdb as ndb import sco_utils as scu +import sco_core import sco_groups from notes_log import log from TrivialFormulator import TrivialFormulator, TF @@ -384,8 +385,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "size": 32, "title": "Element(s) Apogée:", "explanation": "du semestre (ex: VRTW1). Séparés par des virgules.", - "allow_null": not sco_preferences.get_preference(context, - "always_require_apo_sem_codes" + "allow_null": not sco_preferences.get_preference( + context, "always_require_apo_sem_codes" ), }, ) @@ -397,8 +398,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "size": 32, "title": "Element(s) Apogée:", "explanation": "de l'année (ex: VRT1A). Séparés par des virgules.", - "allow_null": not sco_preferences.get_preference(context, - "always_require_apo_sem_codes" + "allow_null": not sco_preferences.get_preference( + context, "always_require_apo_sem_codes" ), }, ) @@ -643,7 +644,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): # check dates if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]): msg = '' - 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)] ): msg = '' @@ -1341,7 +1344,9 @@ def do_formsemestre_delete(context, formsemestre_id, REQUEST): "DELETE FROM notes_evaluation WHERE evaluation_id=%(evaluation_id)s", 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( 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("") else: z = ["""

Aucune modification

"""] - context._inval_cache( - formsemestre_id=formsemestre_id + sco_core.inval_cache( + context, formsemestre_id=formsemestre_id ) # > modif coef UE cap (modifs notes de _certains_ etudiants) 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] # 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: ImputationDept = sco_preferences.get_preference(context, "DeptName") ImputationDept = ImputationDept.upper() diff --git a/app/scodoc/sco_formsemestre_exterieurs.py b/app/scodoc/sco_formsemestre_exterieurs.py index c2343453..42d68e04 100644 --- a/app/scodoc/sco_formsemestre_exterieurs.py +++ b/app/scodoc/sco_formsemestre_exterieurs.py @@ -256,10 +256,13 @@ def formsemestre_ext_edit_ue_validations( 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"]) H = [ - html_sco_header.sco_header(context, + html_sco_header.sco_header( + context, REQUEST, page_title="Validation des UE d'un semestre extérieur", javascripts=["js/formsemestre_ext_edit_ue_validations.js"], diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 023dc077..9bc0b0cb 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -120,7 +120,10 @@ def formsemestre_inscription_with_modules_form( Si only_ext, ne montre que les semestre extérieurs. """ etud = context.getEtudInfo(etudid=etudid, filled=1)[0] - H = [html_sco_header.sco_header(context, REQUEST), "

Inscription de %s" % etud["nomprenom"]] + H = [ + html_sco_header.sco_header(context, REQUEST), + "

Inscription de %s" % etud["nomprenom"], + ] if only_ext: H.append(" dans un semestre extérieur") H.append( @@ -177,8 +180,11 @@ def formsemestre_inscription_with_modules( sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) etud = context.getEtudInfo(etudid=etudid, filled=1)[0] H = [ - html_sco_header.html_sem_header(context, - REQUEST, "Inscription de %s dans ce semestre" % etud["nomprenom"], sem + html_sco_header.html_sem_header( + context, + REQUEST, + "Inscription de %s dans ce semestre" % etud["nomprenom"], + sem, ) ] 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") 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 ) # > get_etud_ue_status @@ -584,7 +590,7 @@ def list_inscrits_ailleurs(context, formsemestre_id): Pour chacun, donne la liste des semestres. { etudid : [ liste de sems ] } """ - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > 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) H = [ - html_sco_header.html_sem_header(context, - REQUEST, "Inscriptions multiples parmi les étudiants du semestre ", sem + html_sco_header.html_sem_header( + context, + REQUEST, + "Inscriptions multiples parmi les étudiants du semestre ", + sem, ) ] insd = list_inscrits_ailleurs(context, formsemestre_id) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index f1782502..bac3529d 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -518,7 +518,9 @@ def fill_formsemestre(context, sem, REQUEST=None): ) else: 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": eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés") else: @@ -565,10 +567,12 @@ def formsemestre_description_table( Liste des modules et de leurs coefficients """ 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 ) # > 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] parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"]) Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( @@ -960,7 +964,9 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None): ), """

Tableau de bord: cliquez sur un module pour saisir des notes

""", ] - nt = context._getNotesCache().get_NotesTable(context, formsemestre_id) + nt = sco_core.get_notes_cache( + context, + ).get_NotesTable(context, formsemestre_id) if nt.expr_diagnostics: H.append(html_expr_diagnostic(context, nt.expr_diagnostics)) H.append( diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 9ce169cc..af251603 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -58,7 +58,7 @@ def formsemestre_validation_etud_form( readonly=True, REQUEST=None, ): - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > get_table_moyennes_triees, get_etud_decision_sem T = nt.get_table_moyennes_triees() @@ -97,7 +97,8 @@ def formsemestre_validation_etud_form( raise ScoValueError("validation: semestre verrouille") H = [ - html_sco_header.sco_header(context, + html_sco_header.sco_header( + context, REQUEST, page_title="Parcours %(nomprenom)s" % etud, javascripts=["js/recap_parcours.js"], @@ -401,9 +402,9 @@ def formsemestre_validation_etud_manu( def _redirect_valid_choice( formsemestre_id, etudid, Se, choice, desturl, sortcol, REQUEST ): - adr = ( - "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1" - % (formsemestre_id, etudid) + adr = "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1" % ( + formsemestre_id, + etudid, ) if sortcol: adr += "&sortcol=" + sortcol @@ -522,7 +523,7 @@ def formsemestre_recap_parcours_table( else: ass = "" - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, sem["formsemestre_id"] ) # > get_ues, get_etud_moy_gen, get_etud_ue_status if is_cur: @@ -656,7 +657,9 @@ def formsemestre_recap_parcours_table( H.append("") # 3eme ligne: ECTS 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 ): 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" sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) H = [ - html_sco_header.html_sem_header(context, - REQUEST, "Saisie automatique des décisions du semestre", sem + html_sco_header.html_sem_header( + context, REQUEST, "Saisie automatique des décisions du semestre", sem ), """ ", ] - context._inval_cache(formsemestre_id=formsemestre_id) # > modif decision UE + sco_core.inval_cache( + context, formsemestre_id=formsemestre_id + ) # > modif decision UE else: H.append("

Aucune modification: codes UE corrects ou inexistants

") 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] H = [ - html_sco_header.sco_header(context, + html_sco_header.sco_header( + context, REQUEST, page_title="Validation UE", javascripts=["js/validate_previous_ue.js"], @@ -1160,7 +1168,13 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
""" 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: return REQUEST.RESPONSE.redirect( context.NotesURL() @@ -1207,7 +1221,7 @@ def do_formsemestre_validate_previous_ue( """ sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) cnx = context.GetDBConnexion(autocommit=False) - nt = context._getNotesCache().get_NotesTable( + nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > get_etud_ue_status if ue_coefficient != None: @@ -1256,8 +1270,8 @@ def _invalidate_etud_formation_caches(context, etudid, formation_id): {"etudid": etudid, "formation_id": formation_id}, ) for fsid in [s["formsemestre_id"] for s in r]: - context._inval_cache( - formsemestre_id=fsid + sco_core.inval_cache( + context, formsemestre_id=fsid ) # > modif decision UE (inval tous semestres avec cet etudiant, ok mais conservatif) diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index 2817e7fe..6c2dbf45 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -818,8 +818,11 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None): ) # H = [ - html_sco_header.sco_header(context, - REQUEST, page_title="Partitions...", javascripts=["js/editPartitionForm.js"] + html_sco_header.sco_header( + context, + REQUEST, + page_title="Partitions...", + javascripts=["js/editPartitionForm.js"], ), r"""