THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class PendingView(_FlashData): (source)
Constructor: PendingView(engine, template, context, status_code, ...)
Represent an awaitable, chainable template rendering result.
Created by orionis.view.contracts.factory.IViewFactory.make.
Rendering is deferred until the object is awaited, so response mutators such as withInput(), withErrors(), withFlash() or withCookie() can be chained directly on the make() call:
return await View.make("auth.login").withErrors(errors)
Callable attributes on orionis.http.HTMLResponse are accepted and
replayed on the real response once the template has been rendered. Initial
response options are applied before queued mutations, in call order.
| Method | __await__ |
Render the template and apply every queued mutation. |
| Async Method | __flash |
Write the queued flash data into the active session. |
| Method | __getattr__ |
Queue a orionis.http.HTMLResponse call to replay after rendering. |
| Method | __init__ |
Store the rendering intent without performing any work. |
| Method | __queue |
Retain a response mutation in call order without rendering. |
| Async Method | render |
Render the template into a fully formed orionis.http.HTMLResponse. |
| Method | with |
Queue a background task change and return the pending view. |
| Method | with |
Queue response headers and return the pending view. |
| Method | with |
Queue an HTTP status change and return the pending view. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _background |
Initial background task, executed only after response delivery. |
| Instance Variable | _context |
Template variables forwarded to the engine. |
| Instance Variable | _engine |
Engine used to render the template once awaited. |
| Instance Variable | _flash |
Session values scheduled for availability during the next request. |
| Instance Variable | _headers |
Initial response headers, separate from template variables. |
| Instance Variable | _mutations |
Response changes queued while configuring the pending view. |
| Instance Variable | _status |
Initial HTTP status code, validated when the view is rendered. |
| Instance Variable | _template |
Template name using dot notation or a relative path. |
Inherited from _FlashData:
| Method | with |
Flash validation errors for the next request. |
| Method | with |
Queue a status message for the owning response or pending view. |
| Method | with |
Flash the submitted payload so the next request can repopulate it. |
Render the template and apply every queued mutation.
| Returns | |
collections.abc.Generator[typing.Any, None, orionis.http.HTMLResponse] | Generator yielding control until the response is ready. |
Write the queued flash data into the active session.
Skip writes when the session is unavailable, such as on routes without session middleware, and centrally observe unexpected resolution failures.
| Returns | |
None | No return value. |
Queue a orionis.http.HTMLResponse call to replay after rendering.
| Parameters | |
name:str | Name of the response method being chained. |
| Returns | |
collections.abc.Callable[..., orionis.view.pending.PendingView] | Callable that records the invocation and returns self. |
| Raises | |
AttributeError | If orionis.http.HTMLResponse exposes no callable named name. |
Self, engine: IViewEngine, template: str, context: dict[ str, Any], *, status_code: HTTPStatus | int = 200, headers: Mapping[ str, str] | None = None, background: BackgroundTask | None = None):
(source)
¶
Store the rendering intent without performing any work.
| Parameters | |
engine:orionis.view.contracts.engine.IViewEngine | Engine used to render the template once awaited. |
template:str | Template name using dot notation or a relative path. |
context:dict[str, typing.Any] | Template variables forwarded to the engine. |
statusorionis.http.enums.HTTPStatus | int, optional | HTTP status code for the rendered response. |
headers:collections.abc.Mapping[str, str] | None, optional | Response headers. The SSR marker is added when not supplied. |
background:orionis.background.BackgroundTask | None, optional | Task to run after the response is sent. |
| Returns | |
None | No return value. |
Retain a response mutation in call order without rendering.
| Parameters | |
name:str | Name of the response method to invoke after rendering. |
*args:typing.Any | Positional arguments for the response method. |
**kwargs:typing.Any | Keyword arguments for the response method. |
| Returns | |
Self | The same pending view for fluent chaining. |
Render the template into a fully formed orionis.http.HTMLResponse.
| Returns | |
orionis.http.HTMLResponse | An HTTP response whose body is the rendered HTML content. |
| Raises | |
orionis.view.exceptions.ViewTemplateNotFoundException | When the view file cannot be located. |
orionis.view.exceptions.ViewRenderException | When rendering fails for any reason. |
orionis.support.concurrency.WorkQueueFullError | When the engine's template loading workers are saturated. |
TypeError | When response options have incompatible types. |
ValueError | When a response status code is outside the supported range. |
Queue a background task change and return the pending view.
| Parameters | |
background:orionis.background.BackgroundTask | None | Task to run after delivery, or None to clear the current task. Validated when the view is awaited. |
| Returns | |
Self | The same pending view for fluent chaining. |
Queue response headers and return the pending view.
| Parameters | |
headers:collections.abc.Mapping[str, str] | Headers to merge, replacing matching names without regard to case. Unrelated headers remain unchanged. |
| Returns | |
Self | The same pending view for fluent chaining. |
Queue an HTTP status change and return the pending view.
| Parameters | |
statusorionis.http.enums.HTTPStatus | int | HTTP status code, validated when the view is awaited. |
| Returns | |
Self | The same pending view for fluent chaining. |
orionis.session.flash._FlashData._flashSession values scheduled for availability during the next request.