diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index ca49fc1b79..9df33d69c0 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -107,17 +107,15 @@ def get_sem_ues_modimpls(context, formsemestre_id, modimpls=None): (utilisé quand on ne peut pas construire nt et faire nt.get_ues()) """ if modimpls is None: - modimpls = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ) + modimpls = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) uedict = {} for modimpl in modimpls: - mod = sco_edit_module.do_module_list( - context, args={"module_id": modimpl["module_id"]} - )[0] + mod = sco_edit_module.do_module_list(args={"module_id": modimpl["module_id"]})[ + 0 + ] modimpl["module"] = mod if not mod["ue_id"] in uedict: - ue = sco_edit_ue.do_ue_list(context, args={"ue_id": mod["ue_id"]})[0] + ue = sco_edit_ue.do_ue_list(args={"ue_id": mod["ue_id"]})[0] uedict[ue["ue_id"]] = ue ues = list(uedict.values()) ues.sort(key=lambda u: u["numero"]) @@ -231,14 +229,14 @@ class NotesTable(object): for modimpl in self._modimpls: mod = modimpl["module"] # has been added here by do_formsemestre_moyennes if not mod["ue_id"] in uedict: - ue = sco_edit_ue.do_ue_list(context, args={"ue_id": mod["ue_id"]})[0] + ue = sco_edit_ue.do_ue_list(args={"ue_id": mod["ue_id"]})[0] uedict[ue["ue_id"]] = ue else: ue = uedict[mod["ue_id"]] modimpl["ue"] = ue # add ue dict to moduleimpl self._matmoys[mod["matiere_id"]] = {} mat = sco_edit_matiere.do_matiere_list( - context, args={"matiere_id": mod["matiere_id"]} + args={"matiere_id": mod["matiere_id"]} )[0] modimpl["mat"] = mat # add matiere dict to moduleimpl # calcul moyennes du module et stocke dans le module diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 025bc6d439..24e03cd072 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -1061,7 +1061,7 @@ def invalidate_abs_count_sem(sem): """Invalidate (clear) cached abs counts for all the students of this semestre""" inscriptions = ( sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits( - None, sem["formsemestre_id"] + sem["formsemestre_id"] ) ) for ins in inscriptions: diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index 0d7f169261..c9151e4df6 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -122,7 +122,7 @@ def doSignaleAbsence( J = "NON " M = "" if moduleimpl_id and moduleimpl_id != "NULL": - mod = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] + mod = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] formsemestre_id = mod["formsemestre_id"] nt = sco_cache.NotesTableCache.get(formsemestre_id) ues = nt.get_ues(etudid=etudid) @@ -967,7 +967,7 @@ def _TablesAbsEtud( ex = [] for ev in a["evals"]: mod = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, moduleimpl_id=ev["moduleimpl_id"] + moduleimpl_id=ev["moduleimpl_id"] )[0] if format == "html": ex.append( @@ -984,7 +984,7 @@ def _TablesAbsEtud( ex = [] for ev in a.get("absent", []): mod = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, moduleimpl_id=ev["moduleimpl_id"] + moduleimpl_id=ev["moduleimpl_id"] )[0] if format == "html": ex.append( diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index a08ee5eb67..cc6ef78308 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -372,7 +372,7 @@ def formsemestre_bulletinetud_published_dict( "decisions_ue" ]: # and sco_preferences.get_preference( 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee) for ue_id in decision["decisions_ue"].keys(): - ue = sco_edit_ue.do_ue_list(context, {"ue_id": ue_id})[0] + ue = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0] d["decision_ue"].append( dict( ue_id=ue["ue_id"], diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py index ccc77b7eb9..62fe789887 100644 --- a/app/scodoc/sco_bulletins_xml.py +++ b/app/scodoc/sco_bulletins_xml.py @@ -390,7 +390,7 @@ def make_xml_formsemestre_bulletinetud( "decisions_ue" ]: # and sco_preferences.get_preference( 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee) for ue_id in decision["decisions_ue"].keys(): - ue = sco_edit_ue.do_ue_list(context, {"ue_id": ue_id})[0] + ue = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0] doc.append( Element( "decision_ue", diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 26891762b4..9d727c9231 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -264,7 +264,7 @@ def invalidate_formsemestre( # was inval_cache( context, formsemestre_id=None, else: formsemestre_ids = [ formsemestre_id - ] + sco_parcours_dut.list_formsemestre_utilisateurs_uecap(None, formsemestre_id) + ] + sco_parcours_dut.list_formsemestre_utilisateurs_uecap(formsemestre_id) log(f"----- invalidate_formsemestre: clearing {formsemestre_ids} -----") if not pdfonly: diff --git a/app/scodoc/sco_compute_moy.py b/app/scodoc/sco_compute_moy.py index 95ea762efe..f4615301b8 100644 --- a/app/scodoc/sco_compute_moy.py +++ b/app/scodoc/sco_compute_moy.py @@ -79,9 +79,7 @@ def formsemestre_expressions_use_abscounts(context, formsemestre_id): if expr and expr[0] != "#" and ab in expr: return True # 2- moyennes de modules - for mod in sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ): + for mod in sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id): if moduleimpl_has_expression(context, mod) and ab in mod["computation_expr"]: return True return False @@ -203,7 +201,7 @@ def do_moduleimpl_moyennes(context, nt, mod): is_malus = mod["module"]["module_type"] == scu.MODULE_MALUS sem = sco_formsemestre.get_formsemestre(mod["formsemestre_id"]) etudids = sco_moduleimpl.do_moduleimpl_listeetuds( - context, moduleimpl_id + moduleimpl_id ) # tous, y compris demissions # Inscrits au semestre (pour traiter les demissions): inssem_set = set( @@ -379,9 +377,7 @@ def do_formsemestre_moyennes(context, nt, formsemestre_id): # args={"formsemestre_id": formsemestre_id} # ) # etudids = [x["etudid"] for x in inscr] - modimpls = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ) + modimpls = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) # recupere les moyennes des etudiants de tous les modules D = {} valid_evals = [] @@ -389,9 +385,9 @@ def do_formsemestre_moyennes(context, nt, formsemestre_id): mods_att = [] expr_diags = [] for modimpl in modimpls: - mod = sco_edit_module.do_module_list( - context, args={"module_id": modimpl["module_id"]} - )[0] + mod = sco_edit_module.do_module_list(args={"module_id": modimpl["module_id"]})[ + 0 + ] modimpl["module"] = mod # add module dict to moduleimpl (used by nt) moduleimpl_id = modimpl["moduleimpl_id"] assert moduleimpl_id not in D diff --git a/app/scodoc/sco_cost_formation.py b/app/scodoc/sco_cost_formation.py index 2afac35c10..2b2dbc101f 100644 --- a/app/scodoc/sco_cost_formation.py +++ b/app/scodoc/sco_cost_formation.py @@ -60,7 +60,7 @@ def formsemestre_table_estim_cost( sem = sco_formsemestre.get_formsemestre(formsemestre_id) sco_formsemestre_status.fill_formsemestre(sem) Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, formsemestre_id=formsemestre_id + formsemestre_id=formsemestre_id ) T = [] for M in Mlist: diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index 31cbd7e792..c7c835cc05 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -64,7 +64,6 @@ def report_debouche_date(context, start_year=None, format="html", REQUEST=None): tab.caption = "Récapitulatif débouchés à partir du 1/1/%s." % start_year tab.base_url = "%s?start_year=%s" % (REQUEST.URL0, start_year) return tab.make_page( - context, title="""
OK, formation supprimée.
""" @@ -95,18 +95,18 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST return "\n".join(H) -def do_formation_delete(context, oid): +def do_formation_delete(oid): """delete a formation (and all its UE, matieres, modules) XXX delete all ues, will break if there are validations ! USE WITH CARE ! """ F = sco_formations.formation_list(args={"formation_id": oid})[0] - if sco_formations.formation_has_locked_sems(context, oid): + if sco_formations.formation_has_locked_sems(oid): raise ScoLockedFormError() cnx = ndb.GetDBConnexion() # delete all UE in this formation - ues = sco_edit_ue.do_ue_list(context, {"formation_id": oid}) + ues = sco_edit_ue.do_ue_list({"formation_id": oid}) for ue in ues: - sco_edit_ue.do_ue_delete(context, ue["ue_id"], force=True) + sco_edit_ue.do_ue_delete(ue["ue_id"], force=True) sco_formations._formationEditor.delete(cnx, oid) @@ -119,12 +119,12 @@ def do_formation_delete(context, oid): ) -def formation_create(context, REQUEST=None): +def formation_create(REQUEST=None): """Creation d'une formation""" - return formation_edit(context, create=True, REQUEST=REQUEST) + return formation_edit(create=True, REQUEST=REQUEST) -def formation_edit(context, formation_id=None, create=False, REQUEST=None): +def formation_edit(formation_id=None, create=False, REQUEST=None): """Edit or create a formation""" if create: H = [ @@ -147,7 +147,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): if not F: raise ScoValueError("formation inexistante !") initvalues = F[0] - is_locked = sco_formations.formation_has_locked_sems(context, formation_id) + is_locked = sco_formations.formation_has_locked_sems(formation_id) submitlabel = "Modifier les valeurs" H = [ html_sco_header.sco_header(page_title="Modification d'une formation"), @@ -247,9 +247,9 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): ) # if create: - formation_id = do_formation_create(context, tf[2]) + formation_id = do_formation_create(tf[2]) else: - do_formation_edit(context, tf[2]) + do_formation_edit(tf[2]) return flask.redirect( url_for( "notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=formation_id @@ -257,7 +257,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): ) -def do_formation_create(context, args): +def do_formation_create(args): "create a formation" cnx = ndb.GetDBConnexion() # check unique acronyme/titre/version @@ -282,14 +282,14 @@ def do_formation_create(context, args): return r -def do_formation_edit(context, args): +def do_formation_edit(args): "edit a formation" # log('do_formation_edit( args=%s )'%args) # On autorise la modif de la formation meme si elle est verrouillee # car cela ne change que du cosmetique, (sauf eventuellement le code formation ?) # mais si verrouillée on ne peut changer le type de parcours - if sco_formations.formation_has_locked_sems(context, args["formation_id"]): + if sco_formations.formation_has_locked_sems(args["formation_id"]): if "type_parcours" in args: del args["type_parcours"] # On ne peut jamais supprimer le code formation: @@ -311,17 +311,15 @@ def invalidate_sems_in_formation(formation_id): ) # > formation modif. -def module_move(context, module_id, after=0, REQUEST=None, redirect=1): +def module_move(module_id, after=0, REQUEST=None, redirect=1): """Move before/after previous one (decrement/increment numero)""" - module = sco_edit_module.do_module_list(context, {"module_id": module_id})[0] + module = sco_edit_module.do_module_list({"module_id": module_id})[0] redirect = int(redirect) after = int(after) # 0: deplace avant, 1 deplace apres if after not in (0, 1): raise ValueError('invalid value for "after"') formation_id = module["formation_id"] - others = sco_edit_module.do_module_list( - context, {"matiere_id": module["matiere_id"]} - ) + others = sco_edit_module.do_module_list({"matiere_id": module["matiere_id"]}) # log('others=%s' % others) if len(others) > 1: idx = [p["module_id"] for p in others].index(module_id) @@ -350,16 +348,16 @@ def module_move(context, module_id, after=0, REQUEST=None, redirect=1): ) -def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1): +def ue_move(ue_id, after=0, REQUEST=None, redirect=1): """Move UE before/after previous one (decrement/increment numero)""" - o = sco_edit_ue.do_ue_list(context, {"ue_id": ue_id})[0] + o = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0] # log('ue_move %s (#%s) after=%s' % (ue_id, o['numero'], after)) redirect = int(redirect) after = int(after) # 0: deplace avant, 1 deplace apres if after not in (0, 1): raise ValueError('invalid value for "after"') formation_id = o["formation_id"] - others = sco_edit_ue.do_ue_list(context, {"formation_id": formation_id}) + others = sco_edit_ue.do_ue_list({"formation_id": formation_id}) if len(others) > 1: idx = [p["ue_id"] for p in others].index(ue_id) neigh = None # object to swap with diff --git a/app/scodoc/sco_edit_matiere.py b/app/scodoc/sco_edit_matiere.py index bb877631f0..4f662a9d8f 100644 --- a/app/scodoc/sco_edit_matiere.py +++ b/app/scodoc/sco_edit_matiere.py @@ -47,31 +47,29 @@ _matiereEditor = ndb.EditableTable( ) -def do_matiere_list(context, *args, **kw): +def do_matiere_list(*args, **kw): "list matieres" cnx = ndb.GetDBConnexion() return _matiereEditor.list(cnx, *args, **kw) -def do_matiere_edit(context, *args, **kw): +def do_matiere_edit(*args, **kw): "edit a matiere" from app.scodoc import sco_edit_ue from app.scodoc import sco_edit_formation cnx = ndb.GetDBConnexion() # check - mat = do_matiere_list(context, {"matiere_id": args[0]["matiere_id"]})[0] - if matiere_is_locked(context, mat["matiere_id"]): + mat = do_matiere_list({"matiere_id": args[0]["matiere_id"]})[0] + if matiere_is_locked(mat["matiere_id"]): raise ScoLockedFormError() # edit _matiereEditor.edit(cnx, *args, **kw) - formation_id = sco_edit_ue.do_ue_list(None, {"ue_id": mat["ue_id"]})[0][ - "formation_id" - ] + formation_id = sco_edit_ue.do_ue_list({"ue_id": mat["ue_id"]})[0]["formation_id"] sco_edit_formation.invalidate_sems_in_formation(formation_id) -def do_matiere_create(context, args): +def do_matiere_create(args): "create a matiere" from app.scodoc import sco_edit_ue from app.scodoc import sco_formations @@ -79,7 +77,7 @@ def do_matiere_create(context, args): cnx = ndb.GetDBConnexion() # check - ue = sco_edit_ue.do_ue_list(context, {"ue_id": args["ue_id"]})[0] + ue = sco_edit_ue.do_ue_list({"ue_id": args["ue_id"]})[0] # create matiere r = _matiereEditor.create(cnx, args) @@ -94,11 +92,11 @@ def do_matiere_create(context, args): return r -def matiere_create(context, ue_id=None, REQUEST=None): +def matiere_create(ue_id=None, REQUEST=None): """Creation d'une matiere""" from app.scodoc import sco_edit_ue - UE = sco_edit_ue.do_ue_list(context, args={"ue_id": ue_id})[0] + UE = sco_edit_ue.do_ue_list(args={"ue_id": ue_id})[0] H = [ html_sco_header.sco_header(page_title="Création d'une matière"), """UE : %(acronyme)s
" % ue) # store min/max values used by JS client-side checks: H.append( @@ -1132,9 +1128,7 @@ def evaluation_create_form( the_eval = do_evaluation_list({"evaluation_id": evaluation_id})[0] moduleimpl_id = the_eval["moduleimpl_id"] # - M = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, moduleimpl_id=moduleimpl_id - )[0] + M = sco_moduleimpl.do_moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[0] is_malus = M["module"]["module_type"] == scu.MODULE_MALUS # True si module de malus formsemestre_id = M["formsemestre_id"] min_note_max = scu.NOTES_PRECISION # le plus petit bareme possible @@ -1193,7 +1187,7 @@ def evaluation_create_form( else: min_note_max_str = "0" # - Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] + Mod = sco_edit_module.do_module_list(args={"module_id": M["module_id"]})[0] # help = """Le coefficient d'une évaluation n'est utilisé que pour pondérer les évaluations au sein d'un module. diff --git a/app/scodoc/sco_export_results.py b/app/scodoc/sco_export_results.py index f10c75bb88..c342773d76 100644 --- a/app/scodoc/sco_export_results.py +++ b/app/scodoc/sco_export_results.py @@ -245,7 +245,7 @@ def scodoc_table_results( ) if format != "html": return tab.make_page( - context, format=format, with_html_headers=False, REQUEST=REQUEST + format=format, with_html_headers=False, REQUEST=REQUEST ) tab_html = tab.html() nb_rows = tab.get_nb_rows() diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py index 24572d9bce..6992645cb3 100644 --- a/app/scodoc/sco_find_etud.py +++ b/app/scodoc/sco_find_etud.py @@ -378,5 +378,5 @@ def search_inscr_etud_by_nip(context, code_nip, REQUEST=None, format="json"): tab = GenTable(columns_ids=columns_ids, rows=T) return tab.make_page( - context, format=format, with_html_headers=False, REQUEST=REQUEST, publish=True + format=format, with_html_headers=False, REQUEST=REQUEST, publish=True ) diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index ff7ef8cce3..83348d8f8b 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -84,7 +84,7 @@ def formation_list(formation_id=None, args={}): return r -def formation_has_locked_sems(context, formation_id): +def formation_has_locked_sems(formation_id): "True if there is a locked formsemestre in this formation" sems = sco_formsemestre.do_formsemestre_list( args={"formation_id": formation_id, "etat": False} @@ -93,13 +93,13 @@ def formation_has_locked_sems(context, formation_id): def formation_export( - context, formation_id, export_ids=False, export_tags=True, format=None, REQUEST=None + formation_id, export_ids=False, export_tags=True, format=None, REQUEST=None ): """Get a formation, with UE, matieres, modules in desired format """ - F = formation_list(context, args={"formation_id": formation_id})[0] - ues = sco_edit_ue.do_ue_list(context, {"formation_id": formation_id}) + F = formation_list(args={"formation_id": formation_id})[0] + ues = sco_edit_ue.do_ue_list({"formation_id": formation_id}) F["ue"] = ues for ue in ues: ue_id = ue["ue_id"] @@ -108,21 +108,19 @@ def formation_export( del ue["formation_id"] if ue["ects"] is None: del ue["ects"] - mats = sco_edit_matiere.do_matiere_list(context, {"ue_id": ue_id}) + mats = sco_edit_matiere.do_matiere_list({"ue_id": ue_id}) ue["matiere"] = mats for mat in mats: matiere_id = mat["matiere_id"] if not export_ids: del mat["matiere_id"] del mat["ue_id"] - mods = sco_edit_module.do_module_list(context, {"matiere_id": matiere_id}) + mods = sco_edit_module.do_module_list({"matiere_id": matiere_id}) mat["module"] = mods for mod in mods: if export_tags: - # mod['tags'] = sco_tag_module.module_tag_list(context, module_id=mod['module_id']) - tags = sco_tag_module.module_tag_list( - context, module_id=mod["module_id"] - ) + # mod['tags'] = sco_tag_module.module_tag_list( module_id=mod['module_id']) + tags = sco_tag_module.module_tag_list(module_id=mod["module_id"]) if tags: mod["tags"] = [{"name": x} for x in tags] if not export_ids: @@ -138,7 +136,7 @@ def formation_export( ) -def formation_import_xml(context, doc: str, import_tags=True): +def formation_import_xml(doc: str, import_tags=True): """Create a formation from XML representation (format dumped by formation_export( format='xml' )) XML may contain object (UE, modules) ids: this function returns two @@ -188,7 +186,7 @@ def formation_import_xml(context, doc: str, import_tags=True): # create formation # F_unquoted = F.copy() # unescape_html_dict(F_unquoted) - formation_id = sco_edit_formation.do_formation_create(context, F) + formation_id = sco_edit_formation.do_formation_create(F) log("formation %s created" % formation_id) ues_old2new = {} # xml ue_id : new ue_id modules_old2new = {} # xml module_id : new module_id @@ -202,14 +200,14 @@ def formation_import_xml(context, doc: str, import_tags=True): del ue_info[1]["ue_id"] else: xml_ue_id = None - ue_id = sco_edit_ue.do_ue_create(context, ue_info[1]) + ue_id = sco_edit_ue.do_ue_create(ue_info[1]) if xml_ue_id: ues_old2new[xml_ue_id] = ue_id # -- create matieres for mat_info in ue_info[2]: assert mat_info[0] == "matiere" mat_info[1]["ue_id"] = ue_id - mat_id = sco_edit_matiere.do_matiere_create(context, mat_info[1]) + mat_id = sco_edit_matiere.do_matiere_create(mat_info[1]) # -- create modules for mod_info in mat_info[2]: assert mod_info[0] == "module" @@ -221,23 +219,23 @@ def formation_import_xml(context, doc: str, import_tags=True): mod_info[1]["formation_id"] = formation_id mod_info[1]["matiere_id"] = mat_id mod_info[1]["ue_id"] = ue_id - mod_id = sco_edit_module.do_module_create(context, mod_info[1]) + mod_id = sco_edit_module.do_module_create(mod_info[1]) if xml_module_id: modules_old2new[int(xml_module_id)] = mod_id if import_tags: if len(mod_info) > 2: tag_names = [t[1]["name"] for t in mod_info[2]] - sco_tag_module.module_tag_set(context, mod_id, tag_names) + sco_tag_module.module_tag_set(mod_id, tag_names) return formation_id, modules_old2new, ues_old2new -def formation_list_table(context, formation_id=None, args={}, REQUEST=None): +def formation_list_table(formation_id=None, args={}, REQUEST=None): """List formation, grouped by titre and sorted by versions and listing associated semestres returns a table """ - formations = formation_list(context, formation_id=formation_id, args=args) + formations = formation_list(formation_id=formation_id, args=args) title = "Programmes pédagogiques" lockicon = scu.icontag( "lock32_img", title="Comporte des semestres verrouillés", border="0" @@ -285,7 +283,7 @@ def formation_list_table(context, formation_id=None, args={}, REQUEST=None): else: f["date_fin_dernier_sem"] = "" f["annee_dernier_sem"] = "" - locked = formation_has_locked_sems(context, f["formation_id"]) + locked = formation_has_locked_sems(f["formation_id"]) # if locked: but_locked = lockicon @@ -354,12 +352,12 @@ def formation_list_table(context, formation_id=None, args={}, REQUEST=None): ) -def formation_create_new_version(context, formation_id, redirect=True, REQUEST=None): +def formation_create_new_version(formation_id, redirect=True, REQUEST=None): "duplicate formation, with new version number" - xml = formation_export(context, formation_id, export_ids=True, format="xml") - new_id, modules_old2new, ues_old2new = formation_import_xml(context, xml) + xml = formation_export(formation_id, export_ids=True, format="xml") + new_id, modules_old2new, ues_old2new = formation_import_xml(xml) # news - F = formation_list(context, args={"formation_id": new_id})[0] + F = formation_list(args={"formation_id": new_id})[0] sco_news.add( typ=sco_news.NEWS_FORM, object=new_id, diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index dfb036fb14..4172bf84e9 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -122,7 +122,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): return "\n".join(H) + html_sco_header.sco_footer() -def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None): +def can_edit_sem(REQUEST, formsemestre_id="", sem=None): """Return sem if user can edit it, False otherwise""" sem = sem or sco_formsemestre.get_formsemestre(formsemestre_id) if not current_user.has_permission(Permission.ScoImplement): # pas chef @@ -168,9 +168,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): initvalues = sem semestre_id = initvalues["semestre_id"] # add associated modules to tf-checked: - ams = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ) + ams = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) sem_module_ids = set([x["module_id"] for x in ams]) initvalues["tf-checked"] = ["MI" + str(x["module_id"]) for x in ams] for x in ams: @@ -203,13 +201,11 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): # on pourrait faire un simple module_list( ) # mais si on veut l'ordre du PPN (groupe par UE et matieres) il faut: mods = [] # liste de dicts - uelist = sco_edit_ue.do_ue_list(context, {"formation_id": formation_id}) + uelist = sco_edit_ue.do_ue_list({"formation_id": formation_id}) for ue in uelist: - matlist = sco_edit_matiere.do_matiere_list(context, {"ue_id": ue["ue_id"]}) + matlist = sco_edit_matiere.do_matiere_list({"ue_id": ue["ue_id"]}) for mat in matlist: - modsmat = sco_edit_module.do_module_list( - context, {"matiere_id": mat["matiere_id"]} - ) + modsmat = sco_edit_module.do_module_list({"matiere_id": mat["matiere_id"]}) # XXX debug checks for m in modsmat: if m["ue_id"] != ue["ue_id"]: @@ -736,7 +732,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "formsemestre_id": formsemestre_id, "responsable_id": tf[2][module_id], } - _ = sco_moduleimpl.do_moduleimpl_create(context, modargs) + _ = sco_moduleimpl.do_moduleimpl_create(modargs) return flask.redirect( "formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé" % formsemestre_id @@ -751,9 +747,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): # (retire le "MI" du début du nom de champs) checkedmods = [int(x[2:]) for x in tf[2]["tf-checked"]] sco_formsemestre.do_formsemestre_edit(tf[2]) - ams = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ) + ams = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) existingmods = [x["module_id"] for x in ams] mods_tocreate = [x for x in checkedmods if not x in existingmods] # modules a existants a modifier @@ -768,10 +762,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "formsemestre_id": formsemestre_id, "responsable_id": tf[2]["MI" + str(module_id)], } - moduleimpl_id = sco_moduleimpl.do_moduleimpl_create(context, modargs) - mod = sco_edit_module.do_module_list(context, {"module_id": module_id})[ - 0 - ] + moduleimpl_id = sco_moduleimpl.do_moduleimpl_create(modargs) + mod = sco_edit_module.do_module_list({"module_id": module_id})[0] msg += ["création de %s (%s)" % (mod["code"], mod["titre"])] # INSCRIPTIONS DES ETUDIANTS log( @@ -788,7 +780,6 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): % (module_id, moduleimpl_id, etudids) ) sco_moduleimpl.do_moduleimpl_inscrit_etuds( - context, moduleimpl_id, formsemestre_id, etudids, @@ -804,13 +795,11 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): % (module_id, moduleimpl_id) ) # - ok, diag = formsemestre_delete_moduleimpls( - context, formsemestre_id, mods_todelete - ) + ok, diag = formsemestre_delete_moduleimpls(formsemestre_id, mods_todelete) msg += diag for module_id in mods_toedit: moduleimpl_id = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id, module_id=module_id + formsemestre_id=formsemestre_id, module_id=module_id )[0]["moduleimpl_id"] modargs = { "moduleimpl_id": moduleimpl_id, @@ -819,11 +808,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "responsable_id": tf[2]["MI" + str(module_id)], } sco_moduleimpl.do_moduleimpl_edit( - context, modargs, formsemestre_id=formsemestre_id + modargs, formsemestre_id=formsemestre_id ) - mod = sco_edit_module.do_module_list(context, {"module_id": module_id})[ - 0 - ] + mod = sco_edit_module.do_module_list({"module_id": module_id})[0] if msg: msg_html = ( @@ -847,7 +834,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): ) -def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del): +def formsemestre_delete_moduleimpls(formsemestre_id, module_ids_to_del): """Delete moduleimpls module_ids_to_del: list of module_id (warning: not moduleimpl) Moduleimpls must have no associated evaluations. @@ -857,9 +844,9 @@ def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del) for module_id in module_ids_to_del: # get id moduleimpl_id = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id, module_id=module_id + formsemestre_id=formsemestre_id, module_id=module_id )[0]["moduleimpl_id"] - mod = sco_edit_module.do_module_list(context, {"module_id": module_id})[0] + mod = sco_edit_module.do_module_list({"module_id": module_id})[0] # Evaluations dans ce module ? evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id}) if evals: @@ -871,7 +858,7 @@ def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del) else: msg += ["suppression de %s (%s)" % (mod["code"], mod["titre"])] sco_moduleimpl.do_moduleimpl_delete( - context, moduleimpl_id, formsemestre_id=formsemestre_id + moduleimpl_id, formsemestre_id=formsemestre_id ) return ok, msg @@ -990,7 +977,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None): ) else: new_formsemestre_id = do_formsemestre_clone( - context, formsemestre_id, User.get_user_id_from_nomplogin(tf[2]["responsable_id"]), tf[2]["date_debut"], @@ -1006,7 +992,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None): def do_formsemestre_clone( - context, orig_formsemestre_id, responsable_id, # new resp. date_debut, @@ -1031,21 +1016,19 @@ def do_formsemestre_clone( formsemestre_id = sco_formsemestre.do_formsemestre_create(args) log("created formsemestre %s" % formsemestre_id) # 2- create moduleimpls - mods_orig = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=orig_formsemestre_id - ) + mods_orig = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=orig_formsemestre_id) for mod_orig in mods_orig: args = mod_orig.copy() args["formsemestre_id"] = formsemestre_id - mid = sco_moduleimpl.do_moduleimpl_create(context, args) + mid = sco_moduleimpl.do_moduleimpl_create(args) # copy notes_modules_enseignants ens = sco_moduleimpl.do_ens_list( - context, args={"moduleimpl_id": mod_orig["moduleimpl_id"]} + args={"moduleimpl_id": mod_orig["moduleimpl_id"]} ) for e in ens: args = e.copy() args["moduleimpl_id"] = mid - sco_moduleimpl.do_ens_create(context, args) + sco_moduleimpl.do_ens_create(args) # optionally, copy evaluations if clone_evaluations: evals = sco_evaluations.do_evaluation_list( @@ -1209,7 +1192,7 @@ def do_formsemestres_associate_new_version(context, formsemestre_ids, REQUEST=No modules_old2new, ues_old2new, ) = sco_formations.formation_create_new_version( - context, formation_id, redirect=False, REQUEST=REQUEST + formation_id, redirect=False, REQUEST=REQUEST ) for formsemestre_id in formsemestre_ids: @@ -1230,12 +1213,10 @@ def _reassociate_moduleimpls( et met à jour les décisions de jury (validations d'UE). """ # re-associate moduleimpls to new modules: - modimpls = sco_moduleimpl.do_moduleimpl_list( - context, formsemestre_id=formsemestre_id - ) + modimpls = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) for mod in modimpls: mod["module_id"] = modules_old2new[mod["module_id"]] - sco_moduleimpl.do_moduleimpl_edit(context, mod, formsemestre_id=formsemestre_id) + sco_moduleimpl.do_moduleimpl_edit(mod, formsemestre_id=formsemestre_id) # update decisions: events = sco_etud.scolar_events_list(cnx, args={"formsemestre_id": formsemestre_id}) for e in events: @@ -1353,7 +1334,7 @@ def do_formsemestre_delete(context, formsemestre_id): sco_cache.EvaluationCache.invalidate_sem(formsemestre_id) # --- Destruction des modules de ce semestre - mods = sco_moduleimpl.do_moduleimpl_list(context, formsemestre_id=formsemestre_id) + mods = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) for mod in mods: # evaluations evals = sco_evaluations.do_evaluation_list( @@ -1374,7 +1355,7 @@ def do_formsemestre_delete(context, formsemestre_id): ) sco_moduleimpl.do_moduleimpl_delete( - context, mod["moduleimpl_id"], formsemestre_id=formsemestre_id + mod["moduleimpl_id"], formsemestre_id=formsemestre_id ) # --- Desinscription des etudiants cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) diff --git a/app/scodoc/sco_formsemestre_exterieurs.py b/app/scodoc/sco_formsemestre_exterieurs.py index d648d9c449..48d4ad1145 100644 --- a/app/scodoc/sco_formsemestre_exterieurs.py +++ b/app/scodoc/sco_formsemestre_exterieurs.py @@ -441,7 +441,7 @@ def _list_ue_with_coef_and_validations(context, sem, etudid): """ cnx = ndb.GetDBConnexion() formsemestre_id = sem["formsemestre_id"] - ue_list = sco_edit_ue.do_ue_list(context, {"formation_id": sem["formation_id"]}) + ue_list = sco_edit_ue.do_ue_list({"formation_id": sem["formation_id"]}) for ue in ue_list: # add coefficient uecoef = sco_formsemestre.formsemestre_uecoef_list( diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 5da1bba3e7..ed4651c8d1 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -170,7 +170,7 @@ def do_formsemestre_desinscription(context, etudid, formsemestre_id, REQUEST=Non moduleimpl_inscription_ids = [x[0] for x in res] for moduleimpl_inscription_id in moduleimpl_inscription_ids: sco_moduleimpl.do_moduleimpl_inscription_delete( - context, moduleimpl_inscription_id, formsemestre_id=formsemestre_id + moduleimpl_inscription_id, formsemestre_id=formsemestre_id ) # -- desincription du semestre do_formsemestre_inscription_delete( @@ -235,12 +235,11 @@ def do_formsemestre_inscription_with_modules( # inscription a tous les modules de ce semestre modimpls = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, formsemestre_id=formsemestre_id + formsemestre_id=formsemestre_id ) for mod in modimpls: if mod["ue"]["type"] != UE_SPORT: sco_moduleimpl.do_moduleimpl_inscription_create( - context, {"moduleimpl_id": mod["moduleimpl_id"], "etudid": etudid}, REQUEST=REQUEST, formsemestre_id=formsemestre_id, @@ -454,10 +453,8 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No ] # Cherche les moduleimpls et les inscriptions - mods = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, formsemestre_id=formsemestre_id - ) - inscr = sco_moduleimpl.do_moduleimpl_inscription_list(context, etudid=etudid) + mods = sco_moduleimpl.do_moduleimpl_withmodule_list(formsemestre_id=formsemestre_id) + inscr = sco_moduleimpl.do_moduleimpl_inscription_list(etudid=etudid) # Formulaire modimpls_by_ue_ids = scu.DictDefault(defaultvalue=[]) # ue_id : [ moduleimpl_id ] modimpls_by_ue_names = scu.DictDefault( @@ -680,14 +677,13 @@ def do_moduleimpl_incription_options( # inscriptions for moduleimpl_id in a_inscrire: # verifie que ce module existe bien - mods = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id) + mods = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id) if len(mods) != 1: raise ScoValueError( "inscription: invalid moduleimpl_id: %s" % moduleimpl_id ) mod = mods[0] sco_moduleimpl.do_moduleimpl_inscription_create( - context, {"moduleimpl_id": moduleimpl_id, "etudid": etudid}, REQUEST=REQUEST, formsemestre_id=mod["formsemestre_id"], @@ -695,14 +691,14 @@ def do_moduleimpl_incription_options( # desinscriptions for moduleimpl_id in a_desinscrire: # verifie que ce module existe bien - mods = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id) + mods = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id) if len(mods) != 1: raise ScoValueError( "desinscription: invalid moduleimpl_id: %s" % moduleimpl_id ) mod = mods[0] inscr = sco_moduleimpl.do_moduleimpl_inscription_list( - context, moduleimpl_id=moduleimpl_id, etudid=etudid + moduleimpl_id=moduleimpl_id, etudid=etudid ) if not inscr: raise ScoValueError( @@ -711,7 +707,7 @@ def do_moduleimpl_incription_options( ) oid = inscr[0]["moduleimpl_inscription_id"] sco_moduleimpl.do_moduleimpl_inscription_delete( - context, oid, formsemestre_id=mod["formsemestre_id"] + oid, formsemestre_id=mod["formsemestre_id"] ) if REQUEST: diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 3234b2e6e4..63e3d676f4 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -464,9 +464,7 @@ def retreive_formsemestre_from_request(): if "formsemestre_id" in args: formsemestre_id = args["formsemestre_id"] elif "moduleimpl_id" in args and args["moduleimpl_id"]: - modimpl = sco_moduleimpl.do_moduleimpl_list( - context, moduleimpl_id=args["moduleimpl_id"] - ) + modimpl = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=args["moduleimpl_id"]) if not modimpl: return None # suppressed ? modimpl = modimpl[0] @@ -476,9 +474,7 @@ def retreive_formsemestre_from_request(): if not E: return None # evaluation suppressed ? E = E[0] - modimpl = sco_moduleimpl.do_moduleimpl_list( - context, moduleimpl_id=E["moduleimpl_id"] - )[0] + modimpl = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] formsemestre_id = modimpl["formsemestre_id"] elif "group_id" in args: group = sco_groups.get_group(args["group_id"]) @@ -596,7 +592,7 @@ def formsemestre_description_table( F = sco_formations.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( - context, formsemestre_id=formsemestre_id + formsemestre_id=formsemestre_id ) R = [] @@ -625,7 +621,7 @@ def formsemestre_description_table( R.append(ue_info) ModInscrits = sco_moduleimpl.do_moduleimpl_inscription_list( - context, moduleimpl_id=M["moduleimpl_id"] + moduleimpl_id=M["moduleimpl_id"] ) enseignants = ", ".join( [sco_users.user_info(m["ens_id"], REQUEST)["nomprenom"] for m in M["ens"]] @@ -891,7 +887,7 @@ def html_expr_diagnostic(context, diagnostics): for diag in diagnostics: if "moduleimpl_id" in diag: mod = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, moduleimpl_id=diag["moduleimpl_id"] + moduleimpl_id=diag["moduleimpl_id"] )[0] H.append( '
Aucune évaluation !
" E = evals[0] moduleimpl_id = E["moduleimpl_id"] - M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] - Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] + M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] + Mod = sco_edit_module.do_module_list(args={"module_id": M["module_id"]})[0] sem = sco_formsemestre.get_formsemestre(M["formsemestre_id"]) # (debug) check that all evals are in same module: for e in evals: @@ -888,7 +888,7 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None): ] # Modules, dans l'ordre Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, formsemestre_id=formsemestre_id + formsemestre_id=formsemestre_id ) for M in Mlist: evals = sco_evaluations.do_evaluation_list( diff --git a/app/scodoc/sco_moduleimpl.py b/app/scodoc/sco_moduleimpl.py index a635e29f2d..4bdba779cf 100644 --- a/app/scodoc/sco_moduleimpl.py +++ b/app/scodoc/sco_moduleimpl.py @@ -63,7 +63,7 @@ _modules_enseignantsEditor = ndb.EditableTable( ) -def do_moduleimpl_create(context, args): +def do_moduleimpl_create(args): "create a moduleimpl" cnx = ndb.GetDBConnexion() r = _moduleimplEditor.create(cnx, args) @@ -73,7 +73,7 @@ def do_moduleimpl_create(context, args): return r -def do_moduleimpl_delete(context, oid, formsemestre_id=None): +def do_moduleimpl_delete(oid, formsemestre_id=None): "delete moduleimpl (desinscrit tous les etudiants)" cnx = ndb.GetDBConnexion() # --- desinscription des etudiants @@ -100,7 +100,7 @@ def do_moduleimpl_delete(context, oid, formsemestre_id=None): def do_moduleimpl_list( - context, moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None + moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None ): "list moduleimpls" args = locals() @@ -108,11 +108,11 @@ def do_moduleimpl_list( modimpls = _moduleimplEditor.list(cnx, args) # Ajoute la liste des enseignants for mo in modimpls: - mo["ens"] = do_ens_list(context, args={"moduleimpl_id": mo["moduleimpl_id"]}) + mo["ens"] = do_ens_list(args={"moduleimpl_id": mo["moduleimpl_id"]}) return scu.return_text_if_published(modimpls, REQUEST) -def do_moduleimpl_edit(context, args, formsemestre_id=None, cnx=None): +def do_moduleimpl_edit(args, formsemestre_id=None, cnx=None): "edit a moduleimpl" if not cnx: cnx = ndb.GetDBConnexion() @@ -124,7 +124,7 @@ def do_moduleimpl_edit(context, args, formsemestre_id=None, cnx=None): def do_moduleimpl_withmodule_list( - context, moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None + moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None ): """Liste les moduleimpls et ajoute dans chacun le module correspondant Tri la liste par semestre/UE/numero_matiere/numero_module. @@ -136,10 +136,8 @@ def do_moduleimpl_withmodule_list( from app.scodoc import sco_edit_module args = locals() - del args["context"] del args["REQUEST"] modimpls = do_moduleimpl_list( - context, **{ "moduleimpl_id": moduleimpl_id, "formsemestre_id": formsemestre_id, @@ -148,13 +146,11 @@ def do_moduleimpl_withmodule_list( ) for mo in modimpls: mo["module"] = sco_edit_module.do_module_list( - context, args={"module_id": mo["module_id"]} - )[0] - mo["ue"] = sco_edit_ue.do_ue_list( - context, args={"ue_id": mo["module"]["ue_id"]} + args={"module_id": mo["module_id"]} )[0] + mo["ue"] = sco_edit_ue.do_ue_list(args={"ue_id": mo["module"]["ue_id"]})[0] mo["matiere"] = sco_edit_matiere.do_matiere_list( - context, args={"matiere_id": mo["module"]["matiere_id"]} + args={"matiere_id": mo["module"]["matiere_id"]} )[0] # tri par semestre/UE/numero_matiere/numero_module @@ -172,9 +168,7 @@ def do_moduleimpl_withmodule_list( return scu.return_text_if_published(modimpls, REQUEST) -def do_moduleimpl_inscription_list( - context, moduleimpl_id=None, etudid=None, REQUEST=None -): +def do_moduleimpl_inscription_list(moduleimpl_id=None, etudid=None, REQUEST=None): "list moduleimpl_inscriptions" args = locals() cnx = ndb.GetDBConnexion() @@ -183,7 +177,7 @@ def do_moduleimpl_inscription_list( ) -def do_moduleimpl_listeetuds(context, moduleimpl_id): +def do_moduleimpl_listeetuds(moduleimpl_id): "retourne liste des etudids inscrits a ce module" req = """SELECT DISTINCT Im.etudid FROM notes_moduleimpl_inscription Im, @@ -200,7 +194,7 @@ def do_moduleimpl_listeetuds(context, moduleimpl_id): return [x[0] for x in res] -def do_moduleimpl_inscrit_tout_semestre(context, moduleimpl_id, formsemestre_id): +def do_moduleimpl_inscrit_tout_semestre(moduleimpl_id, formsemestre_id): "inscrit tous les etudiants inscrit au semestre a ce module" # UNUSED cnx = ndb.GetDBConnexion() @@ -223,7 +217,7 @@ _moduleimpl_inscriptionEditor = ndb.EditableTable( ) -def do_moduleimpl_inscription_create(context, args, REQUEST=None, formsemestre_id=None): +def do_moduleimpl_inscription_create(args, REQUEST=None, formsemestre_id=None): "create a moduleimpl_inscription" cnx = ndb.GetDBConnexion() log("do_moduleimpl_inscription_create: " + str(args)) @@ -242,7 +236,7 @@ def do_moduleimpl_inscription_create(context, args, REQUEST=None, formsemestre_i return r -def do_moduleimpl_inscription_delete(context, oid, formsemestre_id=None): +def do_moduleimpl_inscription_delete(oid, formsemestre_id=None): "delete moduleimpl_inscription" cnx = ndb.GetDBConnexion() _moduleimpl_inscriptionEditor.delete(cnx, oid) @@ -252,7 +246,7 @@ def do_moduleimpl_inscription_delete(context, oid, formsemestre_id=None): def do_moduleimpl_inscrit_etuds( - context, moduleimpl_id, formsemestre_id, etudids, reset=False, REQUEST=None + moduleimpl_id, formsemestre_id, etudids, reset=False, REQUEST=None ): """Inscrit les etudiants (liste d'etudids) a ce module. Si reset, desinscrit tous les autres. @@ -280,16 +274,13 @@ def do_moduleimpl_inscrit_etuds( [ # hum ? x["etudid"] - for x in do_moduleimpl_inscription_list( - context, moduleimpl_id=moduleimpl_id - ) + for x in do_moduleimpl_inscription_list(moduleimpl_id=moduleimpl_id) ] ) for etudid in etudids: # deja inscrit ? if not etudid in inmod_set: do_moduleimpl_inscription_create( - context, {"moduleimpl_id": moduleimpl_id, "etudid": etudid}, REQUEST=REQUEST, formsemestre_id=formsemestre_id, @@ -300,31 +291,31 @@ def do_moduleimpl_inscrit_etuds( ) # > moduleimpl_inscrit_etuds -def do_ens_list(context, *args, **kw): +def do_ens_list(*args, **kw): "liste les enseignants d'un moduleimpl (pas le responsable)" cnx = ndb.GetDBConnexion() ens = _modules_enseignantsEditor.list(cnx, *args, **kw) return ens -def do_ens_edit(context, *args, **kw): +def do_ens_edit(*args, **kw): "edit ens" cnx = ndb.GetDBConnexion() _modules_enseignantsEditor.edit(cnx, *args, **kw) -def do_ens_create(context, args): +def do_ens_create(args): "create ens" cnx = ndb.GetDBConnexion() r = _modules_enseignantsEditor.create(cnx, args) return r -def can_change_module_resp(context, REQUEST, moduleimpl_id): +def can_change_module_resp(REQUEST, moduleimpl_id): """Check if current user can modify module resp. (raise exception if not). = Admin, et dir des etud. (si option l'y autorise) """ - M = do_moduleimpl_withmodule_list(context, moduleimpl_id=moduleimpl_id)[0] + M = do_moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[0] # -- check lock sem = sco_formsemestre.get_formsemestre(M["formsemestre_id"]) if not sem["etat"]: @@ -340,9 +331,9 @@ def can_change_module_resp(context, REQUEST, moduleimpl_id): return M, sem -def can_change_ens(context, REQUEST, moduleimpl_id, raise_exc=True): +def can_change_ens(REQUEST, moduleimpl_id, raise_exc=True): "check if current user can modify ens list (raise exception if not)" - M = do_moduleimpl_withmodule_list(context, moduleimpl_id=moduleimpl_id)[0] + M = do_moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[0] # -- check lock sem = sco_formsemestre.get_formsemestre(M["formsemestre_id"]) if not sem["etat"]: diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index bf40e1e80e..c254145696 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -64,9 +64,9 @@ def moduleimpl_inscriptions_edit( * Si pas les droits: idem en readonly """ - M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] + M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] formsemestre_id = M["formsemestre_id"] - mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] + mod = sco_edit_module.do_module_list(args={"module_id": M["module_id"]})[0] sem = sco_formsemestre.get_formsemestre(formsemestre_id) # -- check lock if not sem["etat"]: @@ -108,7 +108,7 @@ def moduleimpl_inscriptions_edit( ins["etud"] = etuds_info[0] inscrits.sort(key=lambda x: x["etud"]["nom"]) in_m = sco_moduleimpl.do_moduleimpl_inscription_list( - context, moduleimpl_id=M["moduleimpl_id"] + moduleimpl_id=M["moduleimpl_id"] ) in_module = set([x["etudid"] for x in in_m]) # @@ -199,7 +199,7 @@ def moduleimpl_inscriptions_edit( else: # SUBMISSION # inscrit a ce module tous les etuds selectionnes sco_moduleimpl.do_moduleimpl_inscrit_etuds( - context, moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST + moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST ) return flask.redirect("moduleimpl_status?moduleimpl_id=%s" % (moduleimpl_id)) # @@ -265,7 +265,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None): # Liste des modules Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( - context, formsemestre_id=formsemestre_id + formsemestre_id=formsemestre_id ) # Decrit les inscriptions aux modules: commons = [] # modules communs a tous les etuds du semestre @@ -347,10 +347,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None): UECaps = get_etuds_with_capitalized_ue(context, formsemestre_id) if UECaps: H.append('Aucun groupe sélectionné !
" - M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] - Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] + M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] + Mod = sco_edit_module.do_module_list(args={"module_id": M["module_id"]})[0] sem = sco_formsemestre.get_formsemestre(M["formsemestre_id"]) evalname = "%s-%s" % (Mod["code"], ndb.DateDMYtoISO(E["jour"])) if E["description"]: @@ -395,9 +395,7 @@ def do_placement(context, REQUEST): preferences=sco_preferences.SemPreferences(M["formsemestre_id"]), # html_generate_cells=False # la derniere ligne (moyennes) est incomplete ) - t = tab.make_page( - context, format="pdf", with_html_headers=False, REQUEST=REQUEST - ) + t = tab.make_page(format="pdf", with_html_headers=False, REQUEST=REQUEST) return t diff --git a/app/scodoc/sco_poursuite_dut.py b/app/scodoc/sco_poursuite_dut.py index 9ce7daff51..a81f99a133 100644 --- a/app/scodoc/sco_poursuite_dut.py +++ b/app/scodoc/sco_poursuite_dut.py @@ -215,7 +215,6 @@ def formsemestre_poursuite_report( tab.html_caption = "Récapitulatif %s." % sem["titreannee"] tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) return tab.make_page( - context, title="""