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

class IViewEnvironment(ABC): (source)

Known subclasses: orionis.view.environment.ViewEnvironment

View In Hierarchy

Define the operations provided by the view-environment wrapper.

The implementation is the sole authority for configuring the underlying template engine's environment (loaders, caches, globals, filters, tests, and extensions). No other class should access the engine environment directly.

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 available in all templates.
Method addTest Register a test callable used in Jinja2 is expressions.
Method getJinjaEnvironment Return the underlying Jinja2 Environment instance.
Class Variable __slots__ Declare that this class introduces no additional instance slots.
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.
def addFilter(self, name: str, callback: Callable): (source)

Register a filter callable that templates can apply with |.

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

Register a global variable or callable available 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 used in template expressions (e.g. is odd).
callback:collections.abc.CallableFunction that receives the tested value and returns a bool.
Returns
NoneNo return value.
def getJinjaEnvironment(self) -> Any: (source)

Return the underlying Jinja2 Environment instance.

Access is intentionally restricted to this method so that all configuration changes flow through the typed helpers above.

Returns
jinja2.EnvironmentThe configured Jinja2 environment.
__slots__: tuple = (source)

Declare that this class introduces no additional instance slots.