From 545274c562e6794501cd82a9cf7463d9f2ce22a4 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 15 Aug 2021 09:55:35 +0200 Subject: [PATCH] fix for int ids --- app/scodoc/TrivialFormulator.py | 9 ++++++--- app/scodoc/sco_bulletins.py | 11 +++++++---- app/scodoc/sco_etud.py | 4 ++-- app/scodoc/sco_evaluations.py | 2 +- app/scodoc/sco_formsemestre_edit.py | 8 ++++---- app/scodoc/sco_formsemestre_inscriptions.py | 2 +- app/scodoc/sco_liste_notes.py | 12 +++++++----- app/scodoc/sco_moduleimpl_status.py | 2 +- app/views/scolar.py | 2 +- app/views/users.py | 4 ++-- 10 files changed, 32 insertions(+), 24 deletions(-) diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index bb9bb7f20..e894f4d08 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -163,7 +163,7 @@ class TF(object): "true if form has been submitted" if self.is_submitted: return True - return self.values.get("%s-submitted" % self.formid, False) + return self.values.get("%s_submitted" % self.formid, False) def canceled(self): "true if form has been canceled" @@ -363,7 +363,7 @@ class TF(object): '
' % (self.form_url, self.method, self.formid, enctype, name, klass) ) - R.append('' % self.formid) + R.append('' % self.formid) if self.top_buttons: R.append(buttons_markup + "

") R.append('') @@ -490,7 +490,10 @@ class TF(object): # from app.scodoc.notes_log import log # debug only # log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) )) # log("descr['allowed_values'][%s] = '%s'" % (i, repr(descr['allowed_values'][i]))) - if descr["allowed_values"][i] in values[field]: + if ( + values[field] + and descr["allowed_values"][i] in values[field] + ): checked = 'checked="checked"' else: checked = "" diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 9f70acc13..e40eda9bc 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -527,7 +527,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers else: e["name"] = e["description"] or "le %s" % e["jour"] e["target_html"] = ( - "evaluation_listenotes?evaluation_id=%s&format=html&tf-submitted=1" + "evaluation_listenotes?evaluation_id=%s&format=html&tf_submitted=1" % e["evaluation_id"] ) e["name_html"] = '%s' % ( @@ -575,9 +575,12 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers e = e.copy() mod["evaluations_incompletes"].append(e) e["name"] = (e["description"] or "") + " (%s)" % e["jour"] - e["target_html"] = ( - "evaluation_listenotes?evaluation_id=%s&format=html&tf-submitted=1" - % e["evaluation_id"] + e["target_html"] = url_for( + "notes.evaluation_listenotes", + scodoc_dept=g.scodoc_dept, + evaluation_id=e["evaluation_id"], + tf_submitted=1, + format="html", ) e["name_html"] = '%s' % ( e["target_html"], diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index f2a5a423c..ca851306d 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -346,8 +346,8 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None dest_url = "ficheEtud" parameters = {"etudid": etudid} else: - if "tf-submitted" in args: - del args["tf-submitted"] + if "tf_submitted" in args: + del args["tf_submitted"] OK = "Continuer" dest_url = "etudident_create_form" parameters = args diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index cf727909e..b12b5dba2 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -1241,7 +1241,7 @@ def evaluation_create_form( else: initvalues["visibulletinlist"] = [] if ( - REQUEST.form.get("tf-submitted", False) + REQUEST.form.get("tf_submitted", False) and "visibulletinlist" not in REQUEST.form ): REQUEST.form["visibulletinlist"] = [] diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 49c97c402..a3575dedc 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -111,7 +111,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): H.append(r) else: return r # response redirect - if not REQUEST.form.get("tf-submitted", False): + if not REQUEST.form.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".

@@ -625,7 +625,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): else: initvalues["gestion_compensation_lst"] = [] if ( - REQUEST.form.get("tf-submitted", False) + REQUEST.form.get("tf_submitted", False) and "gestion_compensation_lst" not in REQUEST.form ): REQUEST.form["gestion_compensation_lst"] = [] @@ -636,7 +636,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): else: initvalues["gestion_semestrielle_lst"] = [] if ( - REQUEST.form.get("tf-submitted", False) + REQUEST.form.get("tf_submitted", False) and "gestion_semestrielle_lst" not in REQUEST.form ): REQUEST.form["gestion_semestrielle_lst"] = [] @@ -647,7 +647,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): else: initvalues["bul_publish_xml_lst"] = [] if ( - REQUEST.form.get("tf-submitted", False) + REQUEST.form.get("tf_submitted", False) and "bul_publish_xml_lst" not in REQUEST.form ): REQUEST.form["bul_publish_xml_lst"] = [] diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 4ff2068e8..6d510a20d 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -480,7 +480,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No modimpls_by_ue_names[ue_id].append( "%s %s" % (mod["module"]["code"], mod["module"]["titre"]) ) - if not REQUEST.form.get("tf-submitted", False): + if not REQUEST.form.get("tf_submitted", False): # inscrit ? for ins in inscr: if ins["moduleimpl_id"] == mod["moduleimpl_id"]: diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index e801363e2..bfe76353a 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -92,7 +92,7 @@ def do_evaluation_listenotes(context, REQUEST): context, E["evaluation_id"], include_default=True ) grlabs = [g["group_name"] or "tous" for g in groups] # legendes des boutons - grnams = [g["group_id"] for g in groups] # noms des checkbox + grnams = [str(g["group_id"]) for g in groups] # noms des checkbox if len(evals) > 1: descr = [ @@ -414,12 +414,14 @@ def _make_table_notes( for e in evals: rlinks[e["evaluation_id"]] = "afficher" rlinks[ - "_" + e["evaluation_id"] + "_help" + "_" + str(e["evaluation_id"]) + "_help" ] = "afficher seulement les notes de cette évaluation" - rlinks["_" + e["evaluation_id"] + "_target"] = ( - "evaluation_listenotes?evaluation_id=" + e["evaluation_id"] + rlinks["_" + str(e["evaluation_id"]) + "_target"] = url_for( + "notes.evaluation_listenotes", + scodoc_dept=g.scodoc_dept, + evaluation_id=e["evaluation_id"], ) - rlinks["_" + e["evaluation_id"] + "_td_attrs"] = ' class="tdlink" ' + rlinks["_" + str(e["evaluation_id"]) + "_td_attrs"] = ' class="tdlink" ' rows.append(rlinks) if len(evals) == 1: # colonne "Rem." seulement si une eval diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 424d6c08f..dec6e461d 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -574,7 +574,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No if gr_moyenne["gr_nb_notes"] > 0: H.append("%(gr_moy)s" % gr_moyenne) H.append( - """  (%s notes""" + """  (%s notes""" % ( eval["evaluation_id"], gr_moyenne["group_id"], diff --git a/app/views/scolar.py b/app/views/scolar.py index dfd76c41f..5ac226f69 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -1189,7 +1189,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit): infos = [] else: prenom = REQUEST.form.get("prenom", "") - if REQUEST.form.get("tf-submitted", False) and not prenom: + if REQUEST.form.get("tf_submitted", False) and not prenom: prenom = initvalues.get("prenom", "") infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom) diff --git a/app/views/users.py b/app/views/users.py index 9b876b2f1..27dc48481 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -321,9 +321,9 @@ def create_user_form(context, REQUEST, user_name=None, edit=0): }, ), ] - if "tf-submitted" in REQUEST.form and not "roles" in REQUEST.form: + if "tf_submitted" in REQUEST.form and not "roles" in REQUEST.form: REQUEST.form["roles"] = [] - if "tf-submitted" in REQUEST.form: + if "tf_submitted" in REQUEST.form: # Ajoute roles existants mais non modifiables (disabled dans le form) REQUEST.form["roles"] = list( set(REQUEST.form["roles"]).union(