diff --git a/app/scodoc/pe_jurype.py b/app/scodoc/pe_jurype.py index 73440bb8..b5d9b9c5 100644 --- a/app/scodoc/pe_jurype.py +++ b/app/scodoc/pe_jurype.py @@ -1246,7 +1246,7 @@ def get_cosemestres_diplomants(context, semBase, avec_meme_formation=False): diplome = get_annee_diplome_semestre(semBase) if avec_meme_formation: # si une formation est imposee - nom_formation = semBase["formation_id"] + nom_formation = str(semBase["formation_id"]) if pe_tools.PE_DEBUG: pe_tools.pe_print(" - avec formation imposée : ", nom_formation) coSems = [ diff --git a/app/scodoc/pe_tools.py b/app/scodoc/pe_tools.py index fd1587d8..f119d26c 100644 --- a/app/scodoc/pe_tools.py +++ b/app/scodoc/pe_tools.py @@ -87,7 +87,7 @@ def print_semestres_description(sems, avec_affichage_debug=False): + sem["anneescolaire"] ) desc += " (" + sem["annee_debut"] + "/" + sem["annee_fin"] + ") " - desc += sem["formation_id"] + " / " + sem["formsemestre_id"] + desc += str(sem["formation_id"]) + " / " + sem["formsemestre_id"] desc += " - " + sem["titre_num"] return desc diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index 4f6e0123..642baa1a 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -29,6 +29,7 @@ (portage from DTML) """ import flask +from flask import g, url_for import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -251,7 +252,11 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): formation_id = do_formation_create(context, tf[2]) else: do_formation_edit(context, tf[2]) - return flask.redirect("ue_list?formation_id=%s" % formation_id) + return flask.redirect( + url_for( + "notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=formation_id + ) + ) def do_formation_create(context, args): @@ -340,7 +345,11 @@ def module_move(context, module_id, after=0, REQUEST=None, redirect=1): # redirect to ue_list page: if redirect: - return flask.redirect("ue_list?formation_id=" + formation_id) + return flask.redirect( + url_for( + "notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=formation_id + ) + ) def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1): @@ -371,4 +380,10 @@ def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1): sco_edit_ue._ueEditor.edit(cnx, neigh) # redirect to ue_list page if redirect: - return flask.redirect("ue_list?formation_id=" + o["formation_id"]) \ No newline at end of file + return flask.redirect( + url_for( + "notes.ue_list", + scodoc_dept=g.scodoc_dept, + formation_id=o["formation_id"], + ) + ) diff --git a/app/scodoc/sco_edit_matiere.py b/app/scodoc/sco_edit_matiere.py index b3af967e..bcda2a50 100644 --- a/app/scodoc/sco_edit_matiere.py +++ b/app/scodoc/sco_edit_matiere.py @@ -29,6 +29,7 @@ (portage from DTML) """ import flask +from flask import g, url_for import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -136,7 +137,9 @@ associé. submitlabel="Créer cette matière", ) - dest_url = scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"] + dest_url = url_for( + "notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=UE["formation_id"] + ) if tf[0] == 0: return "\n".join(H) + tf[1] + html_sco_header.sco_footer() @@ -283,7 +286,7 @@ associé. submitlabel="Modifier les valeurs", ) - dest_url = scu.NotesURL() + "/ue_list?formation_id=" + U["formation_id"] + dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(U["formation_id"]) if tf[0] == 0: return "\n".join(H) + tf[1] + help + html_sco_header.sco_footer() @@ -325,7 +328,7 @@ def matiere_is_locked(context, matiere_id): WHERE ma.id = mod.matiere_id AND mi.module_id = mod.id AND mi.formsemestre_id = sem.id - AND ma.id = %(matiere_id)s + AND ma.id = %(matiere_id)s AND sem.etat = false """, {"matiere_id": matiere_id}, diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index f087cd1e..51f84379 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -125,7 +125,7 @@ def module_create(context, matiere_id=None, REQUEST=None): from app.scodoc import sco_formations from app.scodoc import sco_edit_ue - if not matiere_id: + if matiere_id is None: raise ScoValueError("invalid matiere !") M = sco_edit_matiere.do_matiere_list(context, args={"matiere_id": matiere_id})[0] UE = sco_edit_ue.do_ue_list(context, args={"ue_id": M["ue_id"]})[0] @@ -298,7 +298,7 @@ def module_delete(context, module_id=None, REQUEST=None): """