chat.models.message

Classes

MessageFile

Message

A single chat message bound to channel.

Functions

init(target, args, kwargs) → None

Ensures that the message id is created upon instantiation. This helps

Module Contents

class chat.models.message.MessageFile[source]

Bases: onegov.file.File

__mapper_args__[source]
class chat.models.message.Message[source]

Bases: onegov.core.orm.Base

A single chat message bound to channel.

__mapper_args__[source]
__tablename__ = 'messages'[source]
id: sqlalchemy.orm.Mapped[str][source]
channel_id: sqlalchemy.orm.Mapped[str][source]
owner: sqlalchemy.orm.Mapped[str | None][source]
type: sqlalchemy.orm.Mapped[str][source]
meta: sqlalchemy.orm.Mapped[dict[str, Any]][source]
text: sqlalchemy.orm.Mapped[str | None][source]
created: sqlalchemy.orm.Mapped[datetime.datetime][source]
modified: sqlalchemy.orm.Mapped[datetime.datetime | None][source]
files[source]
__hash__() → int[source]
__eq__(other: object) → bool[source]
property subtype: str | None[source]

An optional subtype for this message used for separating messages of a type further (currently for UI).

Should be made unique, but there’s no guarantee.

get(request: onegov.core.request.CoreRequest) → str | None[source]

Code rendering a message should call this method to get the actual text of the message. It might be rendered from meta or it might be returned directly from the text column.

How this is done is up to the polymorphic Message.

edited() → bool[source]
classmethod bound_messages(session: sqlalchemy.orm.Session) → onegov.chat.MessageCollection[Self][source]

A message collection bound to the polymorphic identity of this message.

chat.models.message.init(target: Message, args: tuple[Any, ...], kwargs: dict[str, Any]) → None[source]

Ensures that the message id is created upon instantiation. This helps to ensure that each message is ordered according to it’s creation.

Note that messages created within a millisecond of each other are ordered randomly.