fix for int ids

This commit is contained in:
Emmanuel Viennet 2021-08-15 09:55:35 +02:00
parent 7478160094
commit 545274c562
10 changed files with 32 additions and 24 deletions

View File

@ -163,7 +163,7 @@ class TF(object):
"true if form has been submitted" "true if form has been submitted"
if self.is_submitted: if self.is_submitted:
return True return True
return self.values.get("%s-submitted" % self.formid, False) return self.values.get("%s_submitted" % self.formid, False)
def canceled(self): def canceled(self):
"true if form has been canceled" "true if form has been canceled"
@ -363,7 +363,7 @@ class TF(object):
'<form action="%s" method="%s" id="%s" enctype="%s" name="%s" %s>' '<form action="%s" method="%s" id="%s" enctype="%s" name="%s" %s>'
% (self.form_url, self.method, self.formid, enctype, name, klass) % (self.form_url, self.method, self.formid, enctype, name, klass)
) )
R.append('<input type="hidden" name="%s-submitted" value="1"/>' % self.formid) R.append('<input type="hidden" name="%s_submitted" value="1"/>' % self.formid)
if self.top_buttons: if self.top_buttons:
R.append(buttons_markup + "<p></p>") R.append(buttons_markup + "<p></p>")
R.append('<table class="tf">') R.append('<table class="tf">')
@ -490,7 +490,10 @@ class TF(object):
# from app.scodoc.notes_log import log # debug only # from app.scodoc.notes_log import log # debug only
# log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) )) # log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) ))
# log("descr['allowed_values'][%s] = '%s'" % (i, repr(descr['allowed_values'][i]))) # 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"' checked = 'checked="checked"'
else: else:
checked = "" checked = ""

View File

@ -527,7 +527,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
else: else:
e["name"] = e["description"] or "le %s" % e["jour"] e["name"] = e["description"] or "le %s" % e["jour"]
e["target_html"] = ( 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["evaluation_id"]
) )
e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % ( e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % (
@ -575,9 +575,12 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
e = e.copy() e = e.copy()
mod["evaluations_incompletes"].append(e) mod["evaluations_incompletes"].append(e)
e["name"] = (e["description"] or "") + " (%s)" % e["jour"] e["name"] = (e["description"] or "") + " (%s)" % e["jour"]
e["target_html"] = ( e["target_html"] = url_for(
"evaluation_listenotes?evaluation_id=%s&format=html&tf-submitted=1" "notes.evaluation_listenotes",
% e["evaluation_id"] scodoc_dept=g.scodoc_dept,
evaluation_id=e["evaluation_id"],
tf_submitted=1,
format="html",
) )
e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % ( e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % (
e["target_html"], e["target_html"],

View File

@ -346,8 +346,8 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None
dest_url = "ficheEtud" dest_url = "ficheEtud"
parameters = {"etudid": etudid} parameters = {"etudid": etudid}
else: else:
if "tf-submitted" in args: if "tf_submitted" in args:
del args["tf-submitted"] del args["tf_submitted"]
OK = "Continuer" OK = "Continuer"
dest_url = "etudident_create_form" dest_url = "etudident_create_form"
parameters = args parameters = args

View File

@ -1241,7 +1241,7 @@ def evaluation_create_form(
else: else:
initvalues["visibulletinlist"] = [] initvalues["visibulletinlist"] = []
if ( if (
REQUEST.form.get("tf-submitted", False) REQUEST.form.get("tf_submitted", False)
and "visibulletinlist" not in REQUEST.form and "visibulletinlist" not in REQUEST.form
): ):
REQUEST.form["visibulletinlist"] = [] REQUEST.form["visibulletinlist"] = []

View File

@ -111,7 +111,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
H.append(r) H.append(r)
else: else:
return r # response redirect return r # response redirect
if not REQUEST.form.get("tf-submitted", False): if not REQUEST.form.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".
</p> </p>
@ -625,7 +625,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else: else:
initvalues["gestion_compensation_lst"] = [] initvalues["gestion_compensation_lst"] = []
if ( if (
REQUEST.form.get("tf-submitted", False) REQUEST.form.get("tf_submitted", False)
and "gestion_compensation_lst" not in REQUEST.form and "gestion_compensation_lst" not in REQUEST.form
): ):
REQUEST.form["gestion_compensation_lst"] = [] REQUEST.form["gestion_compensation_lst"] = []
@ -636,7 +636,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else: else:
initvalues["gestion_semestrielle_lst"] = [] initvalues["gestion_semestrielle_lst"] = []
if ( if (
REQUEST.form.get("tf-submitted", False) REQUEST.form.get("tf_submitted", False)
and "gestion_semestrielle_lst" not in REQUEST.form and "gestion_semestrielle_lst" not in REQUEST.form
): ):
REQUEST.form["gestion_semestrielle_lst"] = [] REQUEST.form["gestion_semestrielle_lst"] = []
@ -647,7 +647,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else: else:
initvalues["bul_publish_xml_lst"] = [] initvalues["bul_publish_xml_lst"] = []
if ( if (
REQUEST.form.get("tf-submitted", False) REQUEST.form.get("tf_submitted", False)
and "bul_publish_xml_lst" not in REQUEST.form and "bul_publish_xml_lst" not in REQUEST.form
): ):
REQUEST.form["bul_publish_xml_lst"] = [] REQUEST.form["bul_publish_xml_lst"] = []

View File

@ -480,7 +480,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
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"])
) )
if not REQUEST.form.get("tf-submitted", False): if not REQUEST.form.get("tf_submitted", False):
# inscrit ? # inscrit ?
for ins in inscr: for ins in inscr:
if ins["moduleimpl_id"] == mod["moduleimpl_id"]: if ins["moduleimpl_id"] == mod["moduleimpl_id"]:

View File

@ -92,7 +92,7 @@ def do_evaluation_listenotes(context, REQUEST):
context, E["evaluation_id"], include_default=True context, E["evaluation_id"], include_default=True
) )
grlabs = [g["group_name"] or "tous" for g in groups] # legendes des boutons 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: if len(evals) > 1:
descr = [ descr = [
@ -414,12 +414,14 @@ def _make_table_notes(
for e in evals: for e in evals:
rlinks[e["evaluation_id"]] = "afficher" rlinks[e["evaluation_id"]] = "afficher"
rlinks[ rlinks[
"_" + e["evaluation_id"] + "_help" "_" + str(e["evaluation_id"]) + "_help"
] = "afficher seulement les notes de cette évaluation" ] = "afficher seulement les notes de cette évaluation"
rlinks["_" + e["evaluation_id"] + "_target"] = ( rlinks["_" + str(e["evaluation_id"]) + "_target"] = url_for(
"evaluation_listenotes?evaluation_id=" + e["evaluation_id"] "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) rows.append(rlinks)
if len(evals) == 1: # colonne "Rem." seulement si une eval if len(evals) == 1: # colonne "Rem." seulement si une eval

View File

@ -574,7 +574,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
if gr_moyenne["gr_nb_notes"] > 0: if gr_moyenne["gr_nb_notes"] > 0:
H.append("%(gr_moy)s" % gr_moyenne) H.append("%(gr_moy)s" % gr_moyenne)
H.append( H.append(
"""&nbsp; (<a href="evaluation_listenotes?tf-submitted=1&evaluation_id=%s&group_ids%%3Alist=%s">%s notes</a>""" """&nbsp; (<a href="evaluation_listenotes?tf_submitted=1&evaluation_id=%s&group_ids%%3Alist=%s">%s notes</a>"""
% ( % (
eval["evaluation_id"], eval["evaluation_id"],
gr_moyenne["group_id"], gr_moyenne["group_id"],

View File

@ -1189,7 +1189,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
infos = [] infos = []
else: else:
prenom = REQUEST.form.get("prenom", "") 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", "") prenom = initvalues.get("prenom", "")
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom) infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom)

View File

@ -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"] = [] 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) # Ajoute roles existants mais non modifiables (disabled dans le form)
REQUEST.form["roles"] = list( REQUEST.form["roles"] = list(
set(REQUEST.form["roles"]).union( set(REQUEST.form["roles"]).union(