pluserable.data.repository module

Repository implementations.

Repositories are persistence strategies.

class pluserable.data.repository.AbstractRepo(kerno, session_factory=None)[source]

Bases: kerno.repository.sqlalchemy.BaseSQLAlchemyRepository, Generic[pluserable.data.typing.TActivation, pluserable.data.typing.TGroup, pluserable.data.typing.TTUser]

An abstract base class (ABC) defining the repository interface.

abstract delete_activation(user, activation)[source]

Delete the Activation instance from the database.

Return type

None

abstract delete_expired_activations(now=None)[source]

Delete all old activations.

Return type

int

abstract get_activation_by_code(code)[source]

Return the Activation with code, or None.

Return type

Optional[TypeVar(TActivation)]

abstract get_or_create_user_by_email(email, details)[source]

Return User if email exists, else create it with details.

Return type

TypeVar(TTUser)

abstract get_user_by_activation(activation)[source]

Return the user with activation, or None.

Return type

Optional[TypeVar(TTUser)]

abstract get_user_by_email(email)[source]

Return a user with email, or None.

Return type

Optional[TypeVar(TTUser)]

abstract get_user_by_id(id)[source]

Return the user with id, or None.

Return type

Optional[TypeVar(TTUser)]

abstract get_user_by_username(username)[source]

Return a user with username, or None. Case-insensitive.

Return type

Optional[TypeVar(TTUser)]

abstract one_user_by_email(email)[source]

Return a user with email, or raise.

Return type

TypeVar(TTUser)

abstract q_activations()[source]

Return an iterator on all activations.

Return type

Query[TypeVar(TActivation)]

abstract q_groups()[source]

Return an iterator on all groups.

Return type

Query[TypeVar(TGroup)]

abstract q_users()[source]

Return a query for all users.

Return type

Query[TypeVar(TTUser)]