pluserable.actions module

The action layer is also called “service” layer.

It stands between the model layer and the view layer. It is the heart of an application and contains its business rules.

This is because MVC/MVT is insufficient for large apps. Views should be thin. Business rules must be decoupled from the web framework.

class pluserable.actions.ActivateUser(upeto)[source]

Bases: pluserable.actions.UserlessAction

class pluserable.actions.CheckCredentials(upeto)[source]

Bases: pluserable.actions.UserlessAction

Business rules decoupled from the web framework and from persistence.

q_user(handle)[source]

Fetch user. handle can be a username or an email.

Return type

Optional[TUser]

class pluserable.actions.UserlessAction(upeto)[source]

Bases: object

Base class for our actions.

pluserable.actions.create_activation(request, user)[source]

Associate the user with a new activation, or keep the existing one.

Also send an email message with the link for the user to click.

Return the link for the user to click on an email message.

route_url() uses the protocol and domain detected from the current request. Unfortunately in production, that’s usually https for the load balancer, but http for a backend Pyramid server. So we take advantage of a scheme_domain_port configuration setting if provided.

Return type

str

Return the link for the user to click on an email message.

route_url() uses the protocol and domain detected from the current request. Unfortunately in production, that’s usually https for the load balancer, but http for a backend Pyramid server. So we take advantage of a scheme_domain_port configuration setting if provided.

Return type

str

pluserable.actions.send_activation_email(request, user)[source]

Send an extremely simple email message with the activation link.

Although this works fine, most apps will want to build a personalized email message and send it via celery or something else asynchronous.

pluserable.actions.send_reset_password_email(request, user)[source]

Send an extremely simple email message with a link.

Although this works fine, most apps will want to build a personalized email message and send it via celery or something else asynchronous.