tempest_fastapi_sdk.ssr¶
Renderização no servidor: componentes Python tipados renderizados para HTML.
ssr
¶
Server-side rendering: typed Python components rendered to HTML.
Build your FastAPI service full-stack and fully typed — no template
language. Declare pages as :class:Page subclasses (typed
tempest_core components), and return :func:html_response from a
route to render them to HTML on the server. Serve HTMX locally with
:func:make_htmx_router for progressive, server-driven interactivity.
Build the open attrs map of a widget from typed keyword arguments
with :func:htmx, :func:aria and :func:data — they turn
hx-* / aria-* / data-* call sites from stringly-typed dicts
into autocompleted, statically-checked code, returning exactly the plain
dict[str, str] you would have written.
To ship a compiled tempestweb build instead of rendering per
request, point the SDK at a tempestweb build output directory:
:func:make_web_app_router serves a static (wasm) SPA build with a
single-page history fallback, and :func:build_web_app hosts a
server-mode build (WebSocket/SSE) as a mountable sub-application.
:func:detect_build_mode tells the two apart.
Guard a destructive action with :func:confirm (or
form_for(..., confirm=...)): the attribute is read by a locally-served
listener, never interpolated into script. Carry a one-shot notice across
a redirect with :class:FlashMiddleware, :func:flash and
:func:get_flashes; send the browser back where it came from with
:func:redirect_back, which refuses an off-host or off-prefix
Referer; and let :func:register_html_error_handlers answer HTML
routes with an error page or a flash-and-redirect while the API keeps its
JSON.
The rendering backend (tempestweb) is imported lazily, so importing
this package never hard-requires the optional [ssr] extra; the
dependency is touched only when a page is actually rendered.
CONFIRM_ATTRIBUTE
module-attribute
¶
The attribute the bundled confirm.js listener reads.
A <form>, a submit <button> or an <a> carrying it asks
window.confirm with the attribute's text before the browser acts.
GENERIC_ERROR_MESSAGE
module-attribute
¶
Message shown when the JSON error response carries no string detail.
FLASH_COOKIE_NAME
module-attribute
¶
Default name of the cookie that carries the pending messages.
MAX_FLASH_COOKIE_BYTES
module-attribute
¶
Upper bound of the encoded cookie value.
Browsers drop a cookie above roughly 4096 bytes (name, value and attributes together) without telling the server. When the queue would exceed this bound the oldest messages are dropped first, so the most recent notice always arrives.
MAX_FLASH_MESSAGE_LENGTH
module-attribute
¶
Characters kept per message; longer text is cut and ends with ….
FlashMiddleware
¶
FlashMiddleware(
app: ASGIApp,
*,
secret: str,
cookie_name: str = FLASH_COOKIE_NAME,
max_age: int = 300,
path: str = "/",
secure: bool = True,
samesite: Literal["lax", "strict", "none"] = "lax",
)
Pure ASGI middleware that carries flash messages in a signed cookie.
Install it once; then :func:flash and :func:get_flashes work in
every route and exception handler behind it.
The cookie is HttpOnly (no script reads it), SameSite=Lax by
default and scoped to path. Its value is
<payload>.<signature>, where the signature is HMAC-SHA256 over
the payload with secret and a fixed context string, so the same
secret used elsewhere cannot produce a valid flash cookie. A cookie
that fails the signature, fails to decode, or is older than
max_age seconds is ignored and deleted.
Example
Initialize the middleware.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
ASGIApp
|
The wrapped application. |
required |
secret
|
str
|
The signing key. Load it from settings; at least 16 characters. |
required |
cookie_name
|
str
|
Name of the flash cookie. |
FLASH_COOKIE_NAME
|
max_age
|
int
|
Seconds a queued message stays valid. A message not read within it is dropped. |
300
|
path
|
str
|
Cookie path. |
'/'
|
secure
|
bool
|
Emit the |
True
|
samesite
|
Literal['lax', 'strict', 'none']
|
|
'lax'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
encode
¶
encode(messages: list[FlashMessage]) -> str
Encode and sign messages into a cookie value.
Oldest messages are dropped until the value fits
:data:MAX_FLASH_COOKIE_BYTES.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages
|
list[FlashMessage]
|
The messages to carry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
|
decode
¶
decode(value: str) -> list[FlashMessage]
Verify and decode a cookie value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The raw cookie value. |
required |
Returns:
| Type | Description |
|---|---|
list[FlashMessage]
|
list[FlashMessage]: The carried messages; empty when the |
list[FlashMessage]
|
signature does not verify, the value is malformed or it is |
list[FlashMessage]
|
older than |
Page
¶
Bases: Component
Typed page base.
Subclass it, declare fields, and implement :meth:body. Optionally
override :meth:shell to wrap every page in a shared layout. Do not
override :meth:render — it is the Component hook and already
composes shell(body()) for you.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str
|
The page title. :func: |
stylesheets |
ClassVar[Sequence[str]]
|
Stylesheet URLs the
document links, in order. Read by
:func: |
head |
ClassVar[str]
|
Raw markup appended to the document head
(favicon, meta tags). Read by
:func: |
title_suffix |
ClassVar[str]
|
Appended to :attr: |
Example
document_title
¶
Return the text of the document <title>.
Override it when the document title needs more than a suffix (a counter, a prefix that depends on a field).
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
:attr: |
body
¶
Return the page's main content widget tree.
Subclasses must implement this.
Returns:
| Name | Type | Description |
|---|---|---|
Widget |
Widget
|
The widget tree for the page body. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
When a subclass does not implement it. |
shell
¶
Wrap the page body in a shared layout.
The default returns body unchanged. Override in a base page
to add chrome (header / nav / footer) inherited by every concrete
page — :class:~tempest_fastapi_sdk.ui.layout.Shell is the
ready-made frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
Widget
|
The widget tree returned by :meth: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Widget |
Widget
|
The wrapped widget tree. |
render
¶
Compose the page into a single widget tree.
This is the Component render hook. Subclasses override
:meth:body and :meth:shell instead of this method.
Returns:
| Name | Type | Description |
|---|---|---|
Widget |
Widget
|
|
make_htmx_router
¶
Build a router that serves the bundled SSR scripts locally.
The files are read once, at call time, so a real htmx.min.js
dropped into the package after import is still picked up when the
router is constructed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
The router prefix. Defaults to |
'/_ssr'
|
docs_locale
|
str | None
|
Language of the OpenAPI |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
APIRouter
|
class: |
APIRouter
|
(the bundled HTMX) and |
|
APIRouter
|
|
|
APIRouter
|
|
aria
¶
aria(
*,
label: str | None = None,
labelledby: str | None = None,
describedby: str | None = None,
hidden: bool | None = None,
expanded: bool | None = None,
selected: bool | None = None,
checked: bool | None = None,
disabled: bool | None = None,
pressed: bool | None = None,
busy: bool | None = None,
live: str | None = None,
current: str | None = None,
controls: str | None = None,
haspopup: str | None = None,
role: str | None = None,
) -> dict[str, str]
Build ARIA / role attributes for an accessible widget.
Only the arguments you pass appear in the result. role is emitted as
the bare role attribute; every other argument becomes aria-<name>.
Booleans render as "true" / "false".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | None
|
|
None
|
labelledby
|
str | None
|
|
None
|
describedby
|
str | None
|
|
None
|
hidden
|
bool | None
|
|
None
|
expanded
|
bool | None
|
|
None
|
selected
|
bool | None
|
|
None
|
checked
|
bool | None
|
|
None
|
disabled
|
bool | None
|
|
None
|
pressed
|
bool | None
|
|
None
|
busy
|
bool | None
|
|
None
|
live
|
str | None
|
|
None
|
current
|
str | None
|
|
None
|
controls
|
str | None
|
|
None
|
haspopup
|
str | None
|
|
None
|
role
|
str | None
|
The |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
dict[str, str]: The ARIA/role attributes, ready to spread into |
dict[str, str]
|
|
confirm
¶
Build the data-confirm attribute that guards a destructive action.
Spread it into attrs= of a submit <button>, a <form> or an
<a>. :func:~tempest_fastapi_sdk.ssr.html_response includes the
locally-served /_ssr/confirm.js whenever the rendered document
carries the attribute, and that script asks window.confirm with
this text before the submit (or the navigation) goes ahead.
The message is an attribute value, escaped by the renderer and
read back by the script with getAttribute — it is never
interpolated into JavaScript, so a message quoting a user-supplied
name (f"Remover {name}?") cannot inject script. Without
JavaScript the element keeps working, just without the question.
For an element that fires an HTMX request, prefer
htmx(confirm=...) (hx-confirm), which HTMX reads itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The question shown in the confirmation dialog. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
dict[str, str]: |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
data
¶
Build data-* attributes from keyword arguments.
Underscores in a key become hyphens (user_id → data-user-id).
Values are stringified; booleans render as "true" / "false".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**items
|
str | int | float | bool
|
The data attributes. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
dict[str, str]: The |
dict[str, str]
|
|
htmx
¶
htmx(
*,
get: str | None = None,
post: str | None = None,
put: str | None = None,
patch: str | None = None,
delete: str | None = None,
target: str | None = None,
swap: str | None = None,
trigger: str | None = None,
select: str | None = None,
include: str | None = None,
indicator: str | None = None,
confirm: str | None = None,
prompt: str | None = None,
push_url: bool | str | None = None,
swap_oob: bool | str | None = None,
boost: bool | None = None,
disable: bool | None = None,
encoding: str | None = None,
ext: str | None = None,
sync: str | None = None,
params: str | None = None,
vals: str | dict[str, Any] | None = None,
headers: str | dict[str, Any] | None = None,
on: dict[str, str] | None = None,
) -> dict[str, str]
Build the hx-* attribute map for an HTMX-driven widget.
Only the arguments you pass appear in the result. Exactly one of
get/post/put/patch/delete is the usual choice (the
request the element fires). vals / headers accept a mapping and
are JSON-encoded for you; on maps an event spec to inline JS and
becomes hx-on:<event> (e.g. on={":after-request": "this.reset()"}
→ hx-on::after-request).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
get
|
str | None
|
URL for |
None
|
post
|
str | None
|
URL for |
None
|
put
|
str | None
|
URL for |
None
|
patch
|
str | None
|
URL for |
None
|
delete
|
str | None
|
URL for |
None
|
target
|
str | None
|
CSS selector for |
None
|
swap
|
str | None
|
Swap strategy ( |
None
|
trigger
|
str | None
|
Trigger spec for |
None
|
select
|
str | None
|
Response subset selector for |
None
|
include
|
str | None
|
Extra elements to include ( |
None
|
indicator
|
str | None
|
Loading-indicator selector ( |
None
|
confirm
|
str | None
|
|
None
|
prompt
|
str | None
|
|
None
|
push_url
|
bool | str | None
|
|
None
|
swap_oob
|
bool | str | None
|
|
None
|
boost
|
bool | None
|
|
None
|
disable
|
bool | None
|
|
None
|
encoding
|
str | None
|
|
None
|
ext
|
str | None
|
Extensions for |
None
|
sync
|
str | None
|
|
None
|
params
|
str | None
|
|
None
|
vals
|
str | dict[str, Any] | None
|
|
None
|
headers
|
str | dict[str, Any] | None
|
|
None
|
on
|
dict[str, str] | None
|
Event spec → inline JS, each emitted as
|
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
dict[str, str]: The |
dict[str, str]
|
|
register_html_error_handlers
¶
register_html_error_handlers(
app: FastAPI,
*,
prefixes: Sequence[str] = (),
tags: Sequence[str] = (),
error_page: type[ErrorPage] = ErrorPage,
fallback: str | None = None,
) -> None
Answer HTML routes with an error page or a flash-and-redirect.
Call it after :func:tempest_fastapi_sdk.register_exception_handlers
(when the service uses it). It wraps the :class:AppException and
HTTPException handlers registered on app: the wrapped handler
always runs first — so logging, catalog localization and
on_server_error behave exactly as for the API — and then, for a
request to an HTML route:
GET/HEADanswerserror_pagerendered with the same status code and the (localized)detail;- any other method queues the
detailas an"error"flash and answers303back to theRefererthrough :func:~tempest_fastapi_sdk.ssr.redirect_back, validated against the matched prefix. Without :class:~tempest_fastapi_sdk.ssr.FlashMiddlewarethe message would be lost, so the error page is rendered instead.
Every other request keeps the JSON response untouched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
FastAPI
|
The application. |
required |
prefixes
|
Sequence[str]
|
Path prefixes of the HTML routes
( |
()
|
tags
|
Sequence[str]
|
Router tags that mark a route as HTML. Only a matched route has tags, so an unknown path is recognised by prefix alone. |
()
|
error_page
|
type[ErrorPage]
|
The page class rendered on reads,
built through :meth: |
ErrorPage
|
fallback
|
str | None
|
Where the redirect goes when the
|
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When neither |
flash
¶
Queue a message for the next screen this user sees.
Call it before returning the redirect; :class:FlashMiddleware
writes the queue into the signed cookie on that response. Text
longer than :data:MAX_FLASH_MESSAGE_LENGTH is cut.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
message
|
str
|
The notice text. Rendered escaped, but carried readable in the cookie — never put in it what the user may not see. |
required |
variant
|
AlertVariant
|
The severity. |
'info'
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
When :class: |
flash_enabled
¶
Tell whether :class:FlashMiddleware is handling this request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
bool
|
called for |
get_flashes
¶
get_flashes(request: Request) -> list[FlashMessage]
Return every pending message and mark them read.
Pending means the ones the request's cookie carried plus the ones
queued by :func:flash during this request. After this call the
middleware clears the cookie on the response, so a reload does not
repeat them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
Returns:
| Type | Description |
|---|---|
list[FlashMessage]
|
list[FlashMessage]: The messages, oldest first; empty when there |
list[FlashMessage]
|
are none. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
When :class: |
back_url
¶
Return the validated relative URL of the page the request came from.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
allowed_prefix
|
str
|
Only a |
'/'
|
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: |
str | None
|
|
str | None
|
absolute |
str | None
|
user info), or its path is outside the prefix or unsafe. |
redirect_back
¶
redirect_back(
request: Request,
*,
fallback: str,
allowed_prefix: str = "/",
status_code: int = 303,
) -> RedirectResponse
Redirect to the page the request came from, or to a fallback.
The Referer is followed only when it names this host (compared
with the request's own Host) and a path under allowed_prefix;
anything else — another host, no host, a //evil.example path, a
javascript: URL, a path outside the prefix — goes to
fallback. The Location sent is always the relative path, so
even a header that passed cannot change the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
fallback
|
str
|
Where to go when the |
required |
allowed_prefix
|
str
|
The path prefix the |
'/'
|
status_code
|
int
|
The redirect status. |
303
|
Returns:
| Name | Type | Description |
|---|---|---|
RedirectResponse |
RedirectResponse
|
The redirect. |
Example
from fastapi import FastAPI, Request
from fastapi.responses import RedirectResponse
from tempest_fastapi_sdk.ssr import redirect_back
app: FastAPI = FastAPI()
@app.post("/admin/buckets/{name}/delete")
async def delete_bucket(request: Request, name: str) -> RedirectResponse:
return redirect_back(request, fallback="/admin", allowed_prefix="/admin")
html_response
¶
html_response(
widget: Widget,
*,
title: str | None = None,
status_code: int = 200,
htmx: bool = False,
document: bool = True,
lang: str = "pt-BR",
stylesheets: Sequence[str] | None = None,
head: str | None = None,
confirm: bool | None = None,
) -> HTMLResponse
Render a widget tree and return it as a FastAPI HTMLResponse.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
Widget
|
The component / widget tree to render. A
:class: |
required |
title
|
str | None
|
The document |
None
|
status_code
|
int
|
HTTP status code for the response. Defaults to
|
200
|
htmx
|
bool
|
When |
False
|
document
|
bool
|
When |
True
|
lang
|
str
|
The document language attribute. Defaults to
|
'pt-BR'
|
stylesheets
|
Sequence[str] | None
|
URLs added to the document
head as |
None
|
head
|
str | None
|
Raw markup appended to the document head, for
what no argument covers (meta tags, preloads). It is inserted
verbatim — never build it from user input. |
None
|
confirm
|
bool | None
|
Whether to include the locally-served
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
HTMLResponse
|
class: |
HTMLResponse
|
HTML and the given status code. The media type is |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
ImportError
|
When the optional |
build_web_app
¶
build_web_app(
directory: str | Path,
*,
title: str | None = None,
shell: ShellSource | None = None,
theme: Theme | None = None,
) -> FastAPI
Build a FastAPI app hosting a tempestweb server build.
Loads the artifact's app.py (its make_state + view
contract), wires the tempestweb server engine (WebSocket + SSE) via
tempestweb.server.create_app, serves the shared client under
/static and the shell at / — the same wiring the artifact's
generated server.py performs, done in-process. Mount the result
(app.mount("/", web)) or run it directly with uvicorn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
The build directory ( |
required |
title
|
str | None
|
OpenAPI title; defaults to the directory name. |
None
|
shell
|
ShellSource | None
|
Replaces the artifact's
Whatever you supply must keep the script tag that boots the
client; the practical way to write one is to read the
generated |
None
|
theme
|
Theme | None
|
The palette handed to each session's
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
FastAPI |
FastAPI
|
The configured server app (owns |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
Notes
The tempestweb runtime is imported lazily because only the server build mode needs it; a wasm build must not pay for the import.
Example
from pathlib import Path
from fastapi import Request
from tempest_fastapi_sdk.ssr import build_web_app
generated: str = (Path("dist/server") / "index.html").read_text()
def shell(request: Request) -> str:
"Serve the generated shell with the document language fixed."
nonce = getattr(request.state, "csp_nonce", "")
return generated.replace('<html lang="en">', '<html lang="pt-BR">').replace(
"<script",
f'<script nonce="{nonce}"',
1,
)
web = build_web_app("dist/server", shell=shell)
detect_build_mode
¶
detect_build_mode(directory: str | Path) -> BuildMode
Detect whether directory holds a wasm or server build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
A |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BuildMode |
BuildMode
|
|
BuildMode
|
a live WebSocket/SSE artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the directory does not look like a tempestweb
build (no |
make_web_app_router
¶
make_web_app_router(
directory: str | Path,
*,
asset_cache_control: str = "public, max-age=3600",
security_headers: dict[str, str] | None = None,
spa_fallback: bool = True,
shell: ShellSource | None = None,
immutable: Sequence[str] = (),
immutable_manifest: str | None = _IMMUTABLE_MANIFEST,
docs_locale: str | None = None,
) -> APIRouter
Serve a static tempestweb (wasm) build as an APIRouter.
The router serves every file in the build directory and, for any
unmatched path, falls back to index.html so client-side routing
works on a hard refresh (single-page-app history fallback). The wasm
artifact references /sw.js at the site root, so mount this at the
application root — app.include_router(router) — and include it
after your API routers so specific routes win over the catch-all.
Both GET and HEAD are answered; the HEAD routes stay out
of the OpenAPI schema.
Caching: index.html and sw.js are always sent no-cache
(so a redeploy is seen immediately), and so is a shell override.
A path matching immutable or the build's immutable manifest is
sent public, max-age=31536000, immutable; every other asset uses
asset_cache_control. Every file response carries ETag and
Last-Modified and honors If-None-Match / If-Modified-Since
with an empty 304 Not Modified, so no-cache means "revalidate"
and not "download again". No Content-Security-Policy is imposed — a
wasm build runs first-party code and boots Pyodide (which needs
wasm-unsafe-eval); pass security_headers to add your own.
The immutable manifest is a JSON file at the build root,
{"immutable": ["client-3f2a9c/**", "tempestweb-pkg.3f2a9c.zip"]}:
one list of glob patterns relative to the root, where ** crosses
directories and * / ? stay within a segment. Other keys are
ignored. It is read once, when the router is built. The fixed-name
entry points (index.html, sw.js, bootstrap.js,
register.js, manifest.webmanifest) and the manifest itself
are never immutable, whatever a pattern says — their names cannot
change when their bytes do.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
The build directory ( |
required |
asset_cache_control
|
str
|
|
'public, max-age=3600'
|
security_headers
|
dict[str, str] | None
|
Extra headers stamped on
every response. Defaults to |
None
|
spa_fallback
|
bool
|
When |
True
|
shell
|
ShellSource | None
|
Replaces the artifact's
|
None
|
immutable
|
Sequence[str]
|
Glob patterns, relative to the build
root, naming content-addressed paths to cache for a year with
|
()
|
immutable_manifest
|
str | None
|
File name, relative to the build
root, of the manifest whose patterns are added to
|
_IMMUTABLE_MANIFEST
|
docs_locale
|
str | None
|
Language of the OpenAPI |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
APIRouter |
APIRouter
|
A router serving the static build. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
ShellSource
module-attribute
¶
Where the app shell comes from when the generated one is overridden.
str— the HTML document itself.Path— a file read from disk on every request.- callable — invoked per request, so the document can carry a value that
changes per response (a Content-Security-Policy nonce). It takes either
no argument or the :class:
~fastapi.Request, whichever it declares.
flash
¶
Queue a message for the next screen this user sees.
Call it before returning the redirect; :class:FlashMiddleware
writes the queue into the signed cookie on that response. Text
longer than :data:MAX_FLASH_MESSAGE_LENGTH is cut.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The current request. |
required |
message
|
str
|
The notice text. Rendered escaped, but carried readable in the cookie — never put in it what the user may not see. |
required |
variant
|
AlertVariant
|
The severity. |
'info'
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
When :class: |