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 MailComposer: (source)

Constructor: MailComposer(view, storage)

View In Hierarchy

Prepare all bodies and attachments before any transport side effect.

The composer is shared and stateless: every operation keeps its envelope, rendered bodies, and attachment payloads in local variables.

Static Method _compose Build and serialize MIME on a worker using the standard email library.
Method __init__ Inject the configured framework engines without using facades.
Async Method _readAttachment Read one backend-independent binary stream and close it reliably.
Async Method _render Render a view to text without constructing an HTTP response.
Async Method _resolveAttachment Own an attachment task until its stream is closed, even on cancellation.
Async Method prepare Validate, render, load attachments, and compose one immutable message.
Class Variable __slots__ Undocumented
Instance Variable _storage Undocumented
Instance Variable _view Undocumented
def _compose(envelope: Envelope, text: str | None, html: str | None, attachments: tuple[LoadedAttachment, ...]) -> PreparedMail: (source)

Build and serialize MIME on a worker using the standard email library.

Parameters
envelope:EnvelopeValidated final envelope.
text:str | NoneRendered or literal plain-text body.
html:str | NoneRendered or literal HTML body.
attachments:tuple[LoadedAttachment, ...]Fully materialized storage attachments.
Returns
PreparedMailMessage-ID, bytes without Bcc, and a separate recipient union.
Raises
MailCompositionExceptionIf the envelope carries no sender.
def __init__(self, view: IViewEngine, storage: IStorageManager): (source)

Inject the configured framework engines without using facades.

Parameters
view:IViewEngineExisting text-rendering view engine.
storage:IStorageManagerExisting default/named disk resolver.
Returns
NoneStore only shared services, never operation state.
async def _readAttachment(self, attachment: Attachment) -> LoadedAttachment: (source)

Read one backend-independent binary stream and close it reliably.

Parameters
attachment:AttachmentLogical path and optional metadata.
Returns
LoadedAttachmentThe full payload, including a valid zero-byte payload.
Raises
MailAttachmentExceptionIf a driver returns a non-binary failure value.
ExceptionPropagate storage failures to the owning task for translation.
async def _render(self, template: str | None, literal: str | None, content: Content) -> str | None: (source)

Render a view to text without constructing an HTTP response.

Parameters
template:str | NoneOptional view identifier.
literal:str | NoneUnchanged literal when no view was declared.
content:ContentOwner of the isolated explicit view context.
Returns
str | NoneRendered text, literal text, or an undeclared body.
Raises
MailCompositionExceptionIf the configured view engine fails or does not return text.
async def _resolveAttachment(self, attachment: Attachment) -> LoadedAttachment: (source)

Own an attachment task until its stream is closed, even on cancellation.

Parameters
attachment:AttachmentDeferred storage declaration.
Returns
LoadedAttachmentDeclaration, binary data, and optional storage MIME type.
Raises
MailAttachmentExceptionIf storage fails to open, read, inspect, or close the attachment.
asyncio.CancelledErrorAfter in-progress storage work finishes and releases its stream.
async def prepare(self, envelope: Envelope, content: Content, attachments: tuple[Attachment, ...]) -> PreparedMail: (source)

Validate, render, load attachments, and compose one immutable message.

Parameters
envelope:EnvelopeFinal merged headers and intended recipients.
content:ContentValidated literals or views with explicit context.
attachments:tuple[Attachment, ...]Deferred storage declarations in attachment order.
Returns
PreparedMailComplete MIME bytes and transport envelope.
Raises
MailCompositionExceptionIf the envelope, view rendering, or MIME encoding fails.
MailAttachmentExceptionIf any attachment cannot be read or has unsafe metadata.
__slots__: tuple[str, ...] = (source)

Undocumented

_storage = (source)

Undocumented

Undocumented