diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 7d1859a2..0a88f648 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -136,7 +136,8 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"): prefs = sco_preferences.SemPreferences(formsemestre_id) nt = sco_cache.NotesTableCache.get(formsemestre_id) # > toutes notes - + if not nt.get_etud_etat(etudid): + raise ScoValueError("Etudiant non inscrit à ce semestre") I = scu.DictDefault(defaultvalue="") I["etudid"] = etudid I["formsemestre_id"] = formsemestre_id @@ -774,8 +775,8 @@ def formsemestre_bulletinetud( except: sco_etud.log_unknown_etud() raise ScoValueError("étudiant inconnu") - - sem = sco_formsemestre.get_formsemestre(formsemestre_id) + # API, donc erreurs admises en ScoValueError + sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True) bulletin = do_formsemestre_bulletinetud( formsemestre_id, diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index a5509a28..dc1b4f84 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -845,6 +845,7 @@ def ue_sharing_code(ue_code=None, ue_id=None, hide_ue_id=None): """ from app.scodoc import sco_formations + ue_code = str(ue_code) if ue_id: ue = do_ue_list(args={"ue_id": ue_id})[0] if not ue_code: diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index 40355120..2cb9d677 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -93,16 +93,18 @@ _formsemestreEditor = ndb.EditableTable( ) -def get_formsemestre(formsemestre_id): +def get_formsemestre(formsemestre_id, raise_soft_exc=False): "list ONE formsemestre" if not isinstance(formsemestre_id, int): raise ValueError("formsemestre_id must be an integer !") - try: - sem = do_formsemestre_list(args={"formsemestre_id": formsemestre_id})[0] - return sem - except: + sems = do_formsemestre_list(args={"formsemestre_id": formsemestre_id}) + if not sems: log("get_formsemestre: invalid formsemestre_id (%s)" % formsemestre_id) - raise + if raise_soft_exc: + raise ScoValueError(f"semestre {formsemestre_id} inconnu !") + else: + raise ValueError(f"semestre {formsemestre_id} inconnu !") + return sems[0] def do_formsemestre_list(*a, **kw): diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index e85fd4a3..fe8decb0 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -505,15 +505,29 @@ def formsemestre_page_title(): fill_formsemestre(sem) - H = [ - """
""", - """
-%(titre)s%(num_sem)s%(modalitestr)s%(mois_debut)s - %(mois_fin)s%(resp)s%(nbinscrits)d inscrits%(locklink)s%(eyelink)s
""" - % sem, - formsemestre_status_menubar(sem), - """
""", - ] - return "\n".join(H) + h = f"""
+
+ {sem['titre']}{sem['num_sem']}{sem['modalitestr']}{sem['mois_debut']} - {sem['mois_fin']}{sem['resp']}{sem['nbinscrits']} inscrits{sem['locklink']}{sem['eyelink']} +
+ {formsemestre_status_menubar(sem)} +
+ """ + + return h def fill_formsemestre(sem): @@ -967,7 +981,7 @@ def formsemestre_status(formsemestre_id=None): """Tableau de bord semestre HTML""" # porté du DTML cnx = ndb.GetDBConnexion() - sem = sco_formsemestre.get_formsemestre(formsemestre_id) + sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True) Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( formsemestre_id=formsemestre_id )