From d5770669110b4e7cf46549ca7dcaa13aaecb85f3 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 27 Sep 2021 14:54:52 +0200 Subject: [PATCH] Fix regressions (post ablation REQUEST) --- app/scodoc/sco_evaluations.py | 2 +- app/scodoc/sco_formsemestre_edit.py | 24 +++-------------- app/scodoc/sco_formsemestre_inscriptions.py | 2 +- app/scodoc/sco_inscr_passage.py | 1 - app/scodoc/sco_liste_notes.py | 2 +- app/scodoc/sco_saisie_notes.py | 2 +- app/scodoc/sco_trombino.py | 2 +- app/views/entreprises.py | 4 +-- app/views/notes.py | 29 ++++++++++++++++++--- app/views/scolar.py | 4 +-- app/views/users.py | 2 +- sco_version.py | 2 +- 12 files changed, 39 insertions(+), 37 deletions(-) diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index eff9e9107..fe91af313 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -1227,7 +1227,7 @@ def evaluation_create_form( initvalues["visibulletinlist"] = ["X"] else: initvalues["visibulletinlist"] = [] - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if vals.get("tf_submitted", False) and "visibulletinlist" not in vals: request.form["visibulletinlist"] = [] # diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index e5d89f4a8..5beb17beb 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -109,7 +109,7 @@ def formsemestre_editwithmodules(formsemestre_id): H.append(r) else: return r # response redirect - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if not vals.get("tf_submitted", False): H.append( """

Seuls les modules cochés font partie de ce semestre. Pour les retirer, les décocher et appuyer sur le bouton "modifier". @@ -133,7 +133,7 @@ def can_edit_sem(formsemestre_id="", sem=None): def do_formsemestre_createwithmodules(edit=False): "Form choix modules / responsables et creation formsemestre" # Fonction accessible à tous, controle acces à la main: - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if edit: formsemestre_id = int(vals["formsemestre_id"]) sem = sco_formsemestre.get_formsemestre(formsemestre_id) @@ -1434,7 +1434,7 @@ def formsemestre_edit_options(formsemestre_id): return sco_preferences.SemPreferences(formsemestre_id).edit(categories=["bul"]) -def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False) -> None: +def formsemestre_change_lock(formsemestre_id) -> None: """Change etat (verrouille si ouvert, déverrouille si fermé) nota: etat (1 ouvert, 0 fermé) """ @@ -1444,24 +1444,6 @@ def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False) -> None: sem = sco_formsemestre.get_formsemestre(formsemestre_id) etat = not sem["etat"] - if not dialog_confirmed: - if etat: - msg = "déverrouillage" - else: - msg = "verrouillage" - return scu.confirm_dialog( - "

Confirmer le %s du semestre ?

" % msg, - helpmsg="""Les notes d'un semestre verrouillé ne peuvent plus être modifiées. - Un semestre verrouillé peut cependant être déverrouillé facilement à tout moment - (par son responsable ou un administrateur). -
- Le programme d'une formation qui a un semestre verrouillé ne peut plus être modifié. - """, - dest_url="", - cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id, - parameters={"formsemestre_id": formsemestre_id}, - ) - args = {"formsemestre_id": formsemestre_id, "etat": etat} sco_formsemestre.do_formsemestre_edit(args) diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 5d1df1708..90c37d911 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -467,7 +467,7 @@ def formsemestre_inscription_option(etudid, formsemestre_id): modimpls_by_ue_names[ue_id].append( "%s %s" % (mod["module"]["code"], mod["module"]["titre"]) ) - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if not vals.get("tf_submitted", False): # inscrit ? for ins in inscr: diff --git a/app/scodoc/sco_inscr_passage.py b/app/scodoc/sco_inscr_passage.py index 22624f7b3..5adcc5939 100644 --- a/app/scodoc/sco_inscr_passage.py +++ b/app/scodoc/sco_inscr_passage.py @@ -291,7 +291,6 @@ def formsemestre_inscr_passage( etuds = etuds.split(",") # vient du form de confirmation elif isinstance(etuds, int): etuds = [etuds] - auth_etuds_by_sem, inscrits, candidats = list_authorized_etuds_by_sem(sem) etuds_set = set(etuds) candidats_set = set(candidats) diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index 6d6a61110..4a2324820 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -64,7 +64,7 @@ def do_evaluation_listenotes(): (si moduleimpl_id, affiche toutes les évaluatons du module) """ mode = None - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if "evaluation_id" in vals: evaluation_id = int(vals["evaluation_id"]) mode = "eval" diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 8e926b243..07898a622 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -169,7 +169,7 @@ def do_evaluation_upload_xls(): Soumission d'un fichier XLS (evaluation_id, notefile) """ authuser = current_user - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() evaluation_id = int(vals["evaluation_id"]) comment = vals["comment"] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0] diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index 747e92f9e..a5658b96c 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -514,7 +514,7 @@ def photos_import_files_form(group_ids=[]): % groups_infos.groups_query_args, ] F = html_sco_header.sco_footer() - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() vals["group_ids"] = groups_infos.group_ids tf = TrivialFormulator( request.base_url, diff --git a/app/views/entreprises.py b/app/views/entreprises.py index 6843b5189..8a8de35d7 100644 --- a/app/views/entreprises.py +++ b/app/views/entreprises.py @@ -94,7 +94,7 @@ def sidebar(): ) # --- entreprise selectionnée: - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if "entreprise_id" in vals: entreprise_id = vals["entreprise_id"] E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id}) @@ -147,7 +147,7 @@ def index_html(etud_nom=None, limit=50, offset="", format="html"): limit = int(limit) if offset: offset = int(offset or 0) - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if etud_nom: entreprises = sco_entreprises.do_entreprise_list_by_etud( args=vals, sort_on_contact=True diff --git a/app/views/notes.py b/app/views/notes.py index f827fe051..530877af0 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -676,9 +676,30 @@ sco_publish( @permission_required(Permission.ScoView) # acces vérifié dans la fonction @scodoc7func def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False): - sco_formsemestre_edit.formsemestre_change_lock( - formsemestre_id, dialog_confirmed=dialog_confirmed - ) + "Changement de l'état de verrouillage du semestre" + + if not dialog_confirmed: + sem = sco_formsemestre.get_formsemestre(formsemestre_id) + etat = not sem["etat"] + if etat: + msg = "déverrouillage" + else: + msg = "verrouillage" + return scu.confirm_dialog( + "

Confirmer le %s du semestre ?

" % msg, + helpmsg="""Les notes d'un semestre verrouillé ne peuvent plus être modifiées. + Un semestre verrouillé peut cependant être déverrouillé facilement à tout moment + (par son responsable ou un administrateur). +
+ Le programme d'une formation qui a un semestre verrouillé ne peut plus être modifié. + """, + dest_url="", + cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id, + parameters={"formsemestre_id": formsemestre_id}, + ) + + sco_formsemestre_edit.formsemestre_change_lock(formsemestre_id) + return flask.redirect( url_for( "notes.formsemestre_status", @@ -1871,7 +1892,7 @@ def appreciation_add_form( app = apps[0] formsemestre_id = app["formsemestre_id"] etudid = app["etudid"] - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if "edit" in vals: edit = int(vals["edit"]) elif id: diff --git a/app/views/scolar.py b/app/views/scolar.py index f8168efbc..41a2c6a52 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -1134,7 +1134,7 @@ def _etudident_create_or_edit_form(edit): "Le formulaire HTML" H = [html_sco_header.sco_header(init_jquery_ui=True)] F = html_sco_header.sco_footer() - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() etudid = vals.get("etudid", None) cnx = ndb.GetDBConnexion() descr = [] @@ -1177,7 +1177,7 @@ def _etudident_create_or_edit_form(edit): # except ValueError: # infos = None # pass # XXX a terminer - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() nom = vals.get("nom", None) if nom is None: nom = initvalues.get("nom", None) diff --git a/app/views/users.py b/app/views/users.py index 4c44161b1..533b8d789 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -330,7 +330,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1): }, ), ] - vals = request.form if request.method == "POST" else request.args + vals = (request.form if request.method == "POST" else request.args).copy() if "tf_submitted" in vals and not "roles" in vals: vals["roles"] = [] if "tf_submitted" in vals: diff --git a/sco_version.py b/sco_version.py index 8ec2aed9d..41d1cfd97 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.0.39" +SCOVERSION = "9.0.40" SCONAME = "ScoDoc"