def filter_single_or_404(model: t.Type[Y], *criteria: t.Any) -> Y:
"""Get a single object of the specified model by filtering or raise an
exception.
.. note::
``Y`` is bound to :py:class:`psef.models.Base`, so it should be a
SQLAlchemy model.
:param model: The object to get.
:param criteria: The criteria to filter with.
:returns: The requested object.
:raises APIException: If no object with the given id could be found.
(OBJECT_ID_NOT_FOUND)
"""
return t.cast(Y, _filter_or_404(model, False, criteria))
评论列表
文章目录