check invalid etudid

This commit is contained in:
Emmanuel Viennet 2024-06-01 14:27:02 +02:00
parent 21c0625147
commit 3575e89dc0

View File

@ -199,6 +199,11 @@ class Identite(models.ScoDocModel):
@classmethod
def get_etud(cls, etudid: int) -> "Identite":
"""Etudiant ou 404, cherche uniquement dans le département courant"""
if not isinstance(etudid, int):
try:
etudid = int(etudid)
except (TypeError, ValueError):
abort(404, "etudid invalide")
if g.scodoc_dept:
return cls.query.filter_by(
id=etudid, dept_id=g.scodoc_dept_id