1
0
forked from ScoDoc/ScoDoc

Fix regressions (post ablation REQUEST)

This commit is contained in:
Emmanuel Viennet 2021-09-27 14:54:52 +02:00
parent b1fa9b8ef8
commit d577066911
12 changed files with 39 additions and 37 deletions

View File

@ -1227,7 +1227,7 @@ def evaluation_create_form(
initvalues["visibulletinlist"] = ["X"] initvalues["visibulletinlist"] = ["X"]
else: else:
initvalues["visibulletinlist"] = [] 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: if vals.get("tf_submitted", False) and "visibulletinlist" not in vals:
request.form["visibulletinlist"] = [] request.form["visibulletinlist"] = []
# #

View File

@ -109,7 +109,7 @@ def formsemestre_editwithmodules(formsemestre_id):
H.append(r) H.append(r)
else: else:
return r # response redirect 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): if not vals.get("tf_submitted", False):
H.append( H.append(
"""<p class="help">Seuls les modules cochés font partie de ce semestre. Pour les retirer, les décocher et appuyer sur le bouton "modifier". """<p class="help">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): def do_formsemestre_createwithmodules(edit=False):
"Form choix modules / responsables et creation formsemestre" "Form choix modules / responsables et creation formsemestre"
# Fonction accessible à tous, controle acces à la main: # 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: if edit:
formsemestre_id = int(vals["formsemestre_id"]) formsemestre_id = int(vals["formsemestre_id"])
sem = sco_formsemestre.get_formsemestre(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"]) 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é) """Change etat (verrouille si ouvert, déverrouille si fermé)
nota: etat (1 ouvert, 0 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) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
etat = not sem["etat"] etat = not sem["etat"]
if not dialog_confirmed:
if etat:
msg = "déverrouillage"
else:
msg = "verrouillage"
return scu.confirm_dialog(
"<h2>Confirmer le %s du semestre ?</h2>" % 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).
<br/>
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} args = {"formsemestre_id": formsemestre_id, "etat": etat}
sco_formsemestre.do_formsemestre_edit(args) sco_formsemestre.do_formsemestre_edit(args)

View File

@ -467,7 +467,7 @@ def formsemestre_inscription_option(etudid, formsemestre_id):
modimpls_by_ue_names[ue_id].append( modimpls_by_ue_names[ue_id].append(
"%s %s" % (mod["module"]["code"], mod["module"]["titre"]) "%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): if not vals.get("tf_submitted", False):
# inscrit ? # inscrit ?
for ins in inscr: for ins in inscr:

View File

@ -291,7 +291,6 @@ def formsemestre_inscr_passage(
etuds = etuds.split(",") # vient du form de confirmation etuds = etuds.split(",") # vient du form de confirmation
elif isinstance(etuds, int): elif isinstance(etuds, int):
etuds = [etuds] etuds = [etuds]
auth_etuds_by_sem, inscrits, candidats = list_authorized_etuds_by_sem(sem) auth_etuds_by_sem, inscrits, candidats = list_authorized_etuds_by_sem(sem)
etuds_set = set(etuds) etuds_set = set(etuds)
candidats_set = set(candidats) candidats_set = set(candidats)

View File

@ -64,7 +64,7 @@ def do_evaluation_listenotes():
(si moduleimpl_id, affiche toutes les évaluatons du module) (si moduleimpl_id, affiche toutes les évaluatons du module)
""" """
mode = None 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: if "evaluation_id" in vals:
evaluation_id = int(vals["evaluation_id"]) evaluation_id = int(vals["evaluation_id"])
mode = "eval" mode = "eval"

View File

@ -169,7 +169,7 @@ def do_evaluation_upload_xls():
Soumission d'un fichier XLS (evaluation_id, notefile) Soumission d'un fichier XLS (evaluation_id, notefile)
""" """
authuser = current_user 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"]) evaluation_id = int(vals["evaluation_id"])
comment = vals["comment"] comment = vals["comment"]
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]

View File

@ -514,7 +514,7 @@ def photos_import_files_form(group_ids=[]):
% groups_infos.groups_query_args, % groups_infos.groups_query_args,
] ]
F = html_sco_header.sco_footer() 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 vals["group_ids"] = groups_infos.group_ids
tf = TrivialFormulator( tf = TrivialFormulator(
request.base_url, request.base_url,

View File

@ -94,7 +94,7 @@ def sidebar():
) )
# --- entreprise selectionnée: # --- 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: if "entreprise_id" in vals:
entreprise_id = vals["entreprise_id"] entreprise_id = vals["entreprise_id"]
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": 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) limit = int(limit)
if offset: if offset:
offset = int(offset or 0) 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: if etud_nom:
entreprises = sco_entreprises.do_entreprise_list_by_etud( entreprises = sco_entreprises.do_entreprise_list_by_etud(
args=vals, sort_on_contact=True args=vals, sort_on_contact=True

View File

@ -676,9 +676,30 @@ sco_publish(
@permission_required(Permission.ScoView) # acces vérifié dans la fonction @permission_required(Permission.ScoView) # acces vérifié dans la fonction
@scodoc7func @scodoc7func
def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False): def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False):
sco_formsemestre_edit.formsemestre_change_lock( "Changement de l'état de verrouillage du semestre"
formsemestre_id, dialog_confirmed=dialog_confirmed
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(
"<h2>Confirmer le %s du semestre ?</h2>" % 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).
<br/>
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( return flask.redirect(
url_for( url_for(
"notes.formsemestre_status", "notes.formsemestre_status",
@ -1871,7 +1892,7 @@ def appreciation_add_form(
app = apps[0] app = apps[0]
formsemestre_id = app["formsemestre_id"] formsemestre_id = app["formsemestre_id"]
etudid = app["etudid"] 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: if "edit" in vals:
edit = int(vals["edit"]) edit = int(vals["edit"])
elif id: elif id:

View File

@ -1134,7 +1134,7 @@ def _etudident_create_or_edit_form(edit):
"Le formulaire HTML" "Le formulaire HTML"
H = [html_sco_header.sco_header(init_jquery_ui=True)] H = [html_sco_header.sco_header(init_jquery_ui=True)]
F = html_sco_header.sco_footer() 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) etudid = vals.get("etudid", None)
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
descr = [] descr = []
@ -1177,7 +1177,7 @@ def _etudident_create_or_edit_form(edit):
# except ValueError: # except ValueError:
# infos = None # infos = None
# pass # XXX a terminer # 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) nom = vals.get("nom", None)
if nom is None: if nom is None:
nom = initvalues.get("nom", None) nom = initvalues.get("nom", None)

View File

@ -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: if "tf_submitted" in vals and not "roles" in vals:
vals["roles"] = [] vals["roles"] = []
if "tf_submitted" in vals: if "tf_submitted" in vals:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.0.39" SCOVERSION = "9.0.40"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"