diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 7d1859a22..0a88f648a 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 a5509a28e..dc1b4f84e 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 40355120b..2cb9d6770 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 e85fd4a3d..fe8decb00 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 = [ - """