ORIONIS API REFERENCE

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 documentation

Encapsulate and configure a Jinja2 Environment instance.

This is the single authorised class for configuring the underlying template engine. All loaders, caches, globals, filters, tests and extensions must be registered through the public methods of this class.

The Jinja2 Environment is built once during construction and stored internally; no other class may access it directly except through orionis.view.environment.ViewEnvironment.getJinjaEnvironment.

Method __init__ Build the Jinja2 environment from the application view configuration.
Method addExtension Register a Jinja2 extension class with the environment.
Method addFilter Register a filter callable that templates can apply with |.
Method addGlobal Register a global variable or callable in all templates.
Method addTest Register a test callable used in Jinja2 is expressions.
Method getJinjaEnvironment Return the configured Jinja2 Environment instance.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _jinja_env the engine only ever calls render_async and every template global is awaited by Jinja2.
def __init__(self, app: IApplication): (source)

Build the Jinja2 environment from the application view configuration.

Parameters
app:orionis.IApplicationApplication container used to read view configuration and resolve the base path for relative template directories.
Returns
NoneNo return value.
def addExtension(self, extension: Any): (source)

Register a Jinja2 extension class with the environment.

Parameters
extension:typing.AnyA Jinja2 Extension subclass or its dotted import path.
Returns
NoneNo return value.
Raises
orionis.view.exceptions.ViewExceptionWhen the extension cannot be registered by Jinja2.
def addFilter(self, name: str, callback: Callable): (source)

Register a filter callable that templates can apply with |.

Parameters
name:strFilter name referenced inside template expressions (e.g. | slug).
callback:collections.abc.CallableFunction applied to the piped value.
Returns
NoneNo return value.
def addGlobal(self, name: str, value: Any): (source)

Register a global variable or callable in all templates.

Parameters
name:strIdentifier used to reference the value inside templates.
value:typing.AnyValue or callable to expose as a template global.
Returns
NoneNo return value.
def addTest(self, name: str, callback: Callable): (source)

Register a test callable used in Jinja2 is expressions.

Parameters
name:strTest name referenced inside template is expressions.
callback:collections.abc.CallableFunction receiving the tested value and returning a bool.
Returns
NoneNo return value.
def getJinjaEnvironment(self) -> jinja2.Environment: (source)

Return the configured Jinja2 Environment instance.

Returns
jinja2.EnvironmentThe internal Jinja2 environment. Treat as read-only outside this class; all mutations must flow through the typed helpers.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_jinja_env: jinja2.Environment = (source)

the engine only ever calls render_async and every template global is awaited by Jinja2.