MCPcopy
hub / github.com/pallets/flask / abort

Function abort

src/flask/helpers.py:273–293  ·  view source on GitHub ↗

Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given status code. If :data:`~flask.current_app` is available, it will call its :attr:`~flask.Flask.aborter` object, otherwise it will use :func:`werkzeug.exceptions.abort`. :param code: The status code for the exceptio

(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any)

Source from the content-addressed store, hash-verified

271
272
273def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:
274 """Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given
275 status code.
276
277 If :data:`~flask.current_app` is available, it will call its
278 :attr:`~flask.Flask.aborter` object, otherwise it will use
279 :func:`werkzeug.exceptions.abort`.
280
281 :param code: The status code for the exception, which must be
282 registered in ``app.aborter``.
283 :param args: Passed to the exception.
284 :param kwargs: Passed to the exception.
285
286 .. versionadded:: 2.2
287 Calls ``current_app.aborter`` if available instead of always
288 using Werkzeug's default ``abort``.
289 """
290 if current_app:
291 current_app.aborter(code, *args, **kwargs)
292
293 _wz_abort(code, *args, **kwargs)
294
295
296def get_template_attribute(template_name: str, attribute: str) -> t.Any:

Callers 1

get_postFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected