httk.serve.web.widgets.table¶
The built-in, cursor-paginated httk.serve.table widget.
Attributes¶
Exceptions¶
An expected bad table declaration, continuation, or provider result. |
|
A continuation token did not meet the endpoint protocol. |
|
A valid continuation token has passed its expiry. |
|
A site-local provider could not safely supply the requested page. |
|
A provider changed a revision-pinned result while paging. |
Classes¶
Authenticate, but do not encrypt, bounded table continuation state. |
|
Dispatch providers, render table pages, and authenticate continuations. |
|
Adapt the built-in table runtime to the widget protocol. |
Module Contents¶
- exception httk.serve.web.widgets.table.TableProtocolError[source]¶
Bases:
ValueErrorAn expected bad table declaration, continuation, or provider result.
- exception httk.serve.web.widgets.table.TableContinuationError[source]¶
Bases:
TableProtocolErrorA continuation token did not meet the endpoint protocol.
- exception httk.serve.web.widgets.table.TableContinuationExpired[source]¶
Bases:
TableContinuationErrorA valid continuation token has passed its expiry.
- exception httk.serve.web.widgets.table.TableProviderError[source]¶
Bases:
TableProtocolErrorA site-local provider could not safely supply the requested page.
- exception httk.serve.web.widgets.table.TableRevisionMismatch[source]¶
Bases:
TableProviderErrorA provider changed a revision-pinned result while paging.
- class httk.serve.web.widgets.table.TableTokenSigner(secret=None)[source]¶
Authenticate, but do not encrypt, bounded table continuation state.
Continuation state expires and cursor values must not contain secrets.
- Parameters:
secret (str | bytes | None) – Optional signing secret; generated per process when omitted.
- sign(payload)[source]¶
Sign canonical continuation state.
- Parameters:
payload (collections.abc.Mapping[str, object]) – Bounded JSON-like continuation state.
- Returns:
Authenticated continuation token.
- Raises:
TableProtocolError – If the state or token exceeds protocol limits.
- Return type:
- class httk.serve.web.widgets.table.TableRuntime(*, engine, token_secret=None, token_ttl_seconds=DEFAULT_TOKEN_TTL_SECONDS)[source]¶
Dispatch providers, render table pages, and authenticate continuations.
- Parameters:
engine (httk.serve.web.engine.site_engine.SiteEngine) – Site engine that owns this runtime.
token_secret (str | bytes | None) – Optional signing secret for continuation tokens.
token_ttl_seconds (int) – Lifetime of authenticated continuation tokens.
- render(context, **props)[source]¶
Render the first bounded table page and live pagination controls.
Static publication renders only the first page with pagination disabled; live rendering registers the browser assets and continuation endpoint.
- Parameters:
context (httk.serve.web.widgets.core.WidgetContext) – Immutable widget invocation context.
**props (object) – Literal table provider and presentation properties.
- Returns:
Rendered table shell and any live assets.
- Raises:
TableProtocolError – If widget properties or provider state are invalid.
TableProviderError – If the site provider cannot supply the page.
- Return type:
- continuation(payload)[source]¶
Resolve one authenticated browser continuation request.
- Parameters:
payload (object) – Request mapping containing token, route, and widget ID.
- Returns:
Rendered next-page body and continuation metadata.
- Raises:
TableContinuationError – If the request or token is invalid.
TableContinuationExpired – If the token has expired.
TableRevisionMismatch – If the provider revision changed.
TableProviderError – If the provider cannot supply the page.
- Return type:
- class httk.serve.web.widgets.table.TableWidget[source]¶
Adapt the built-in table runtime to the widget protocol.
- render(context, **props)[source]¶
Render a table through the engine-local table runtime.
- Parameters:
context (httk.serve.web.widgets.core.WidgetContext) – Immutable widget invocation context.
**props (object) – Literal table provider and presentation properties.
- Returns:
Rendered table shell and any live assets.
- Raises:
TableProtocolError – If the context has no table runtime.
- Return type: