httk.serve.web.widgets.table

The built-in, cursor-paginated httk.serve.table widget.

Attributes

Exceptions

TableProtocolError

An expected bad table declaration, continuation, or provider result.

TableContinuationError

A continuation token did not meet the endpoint protocol.

TableContinuationExpired

A valid continuation token has passed its expiry.

TableProviderError

A site-local provider could not safely supply the requested page.

TableRevisionMismatch

A provider changed a revision-pinned result while paging.

Classes

TableTokenSigner

Authenticate, but do not encrypt, bounded table continuation state.

TableRuntime

Dispatch providers, render table pages, and authenticate continuations.

TableWidget

Adapt the built-in table runtime to the widget protocol.

Module Contents

httk.serve.web.widgets.table.TABLE_ENDPOINT = '/_httk/serve/table/page'[source]
httk.serve.web.widgets.table.TABLE_ASSET_ROOT = '/_httk/serve/assets'[source]
httk.serve.web.widgets.table.DEFAULT_PAGE_SIZE = 50[source]
httk.serve.web.widgets.table.MAX_PAGE_SIZE = 500[source]
httk.serve.web.widgets.table.MAX_CURSOR_CHARS = 16384[source]
httk.serve.web.widgets.table.MAX_TOKEN_BYTES = 48000[source]
httk.serve.web.widgets.table.MAX_TOKEN_PAYLOAD_BYTES = 32768[source]
httk.serve.web.widgets.table.MAX_TABLE_HTML_BYTES = 512000[source]
httk.serve.web.widgets.table.MAX_TABLE_RESPONSE_BYTES = 600000[source]
httk.serve.web.widgets.table.TOKEN_VERSION = 1[source]
httk.serve.web.widgets.table.DEFAULT_TOKEN_TTL_SECONDS = 900[source]
exception httk.serve.web.widgets.table.TableProtocolError[source]

Bases: ValueError

An expected bad table declaration, continuation, or provider result.

exception httk.serve.web.widgets.table.TableContinuationError[source]

Bases: TableProtocolError

A continuation token did not meet the endpoint protocol.

exception httk.serve.web.widgets.table.TableContinuationExpired[source]

Bases: TableContinuationError

A valid continuation token has passed its expiry.

exception httk.serve.web.widgets.table.TableProviderError[source]

Bases: TableProtocolError

A site-local provider could not safely supply the requested page.

exception httk.serve.web.widgets.table.TableRevisionMismatch[source]

Bases: TableProviderError

A 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:

str

verify(token)[source]

Verify and decode an authenticated continuation token.

Parameters:

token (object) – Token supplied by the browser.

Returns:

Authenticated continuation state.

Raises:

TableContinuationError – If the token is malformed or unauthenticated.

Return type:

dict[str, object]

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[source]
signer[source]
token_ttl_seconds = 900[source]
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:
Returns:

Rendered table shell and any live assets.

Raises:
Return type:

httk.serve.web.widgets.core.WidgetRenderResult

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:
Return type:

dict[str, object]

class httk.serve.web.widgets.table.TableWidget[source]

Adapt the built-in table runtime to the widget protocol.

name = 'httk.serve.table'[source]
source = 'httk.serve.web.widgets.table'[source]
render(context, **props)[source]

Render a table through the engine-local table runtime.

Parameters:
Returns:

Rendered table shell and any live assets.

Raises:

TableProtocolError – If the context has no table runtime.

Return type:

httk.serve.web.widgets.core.WidgetRenderResult