assembl.models.action module

Records of actions taken by the platform users.

class assembl.models.action.Action(**kwargs)[source]

Bases: assembl.lib.history_mixin.TombstonableMixin, assembl.lib.history_mixin.OriginMixin, assembl.models.DiscussionBoundBase

An action that can be taken by an actor (a auth.User).

Most actions are expressed in terms of actor-verb-target-time, with verbs including but not restricted to CRUD operations.

container_url()[source]

What is the URL where we expect to find this resource

is_owner(user_id)[source]

The user owns this ressource, and has more permissions.

populate_from_context(context)[source]

If object created in this context, populate some relations from that context.

This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.

classmethod restrict_to_owners_condition(query, user_id, alias=None, alias_maker=None)[source]

filter query according to object owners

class assembl.models.action.ActionOnIdea(**kwargs)[source]

Bases: assembl.models.action.Action

An action that is taken on an idea. (Mixin)

classmethod get_discussion_conditions(discussion_id, alias_maker=None)[source]

Returns a list of SQLA expressions that constrain a query on this class to a given discussion.

get_discussion_id()[source]

Get the ID of an associated discussion object, if any.

populate_from_context(context)[source]

If object created in this context, populate some relations from that context.

This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.

classmethod special_quad_patterns(alias_maker, discussion_id)[source]

Returns a list of quad map patterns for RDF mapping, beyond those defined by introspection.

Important: If defined somewhere, override in subclasses to avoid inheritance.

class assembl.models.action.ActionOnPost(**kwargs)[source]

Bases: assembl.models.action.Action

An action whose target is a post. (Mixin)

classmethod get_discussion_conditions(discussion_id, alias_maker=None)[source]

Returns a list of SQLA expressions that constrain a query on this class to a given discussion.

get_discussion_id()[source]

Get the ID of an associated discussion object, if any.

populate_from_context(context)[source]

If object created in this context, populate some relations from that context.

This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.

classmethod special_quad_patterns(alias_maker, discussion_id)[source]

Returns a list of quad map patterns for RDF mapping, beyond those defined by introspection.

Important: If defined somewhere, override in subclasses to avoid inheritance.

class assembl.models.action.CollapsePost(**kwargs)[source]

Bases: assembl.models.action.UniqueActionOnPost

A collapse action on a post.

class assembl.models.action.ExpandPost(**kwargs)[source]

Bases: assembl.models.action.UniqueActionOnPost

An expansion action on a post.

class assembl.models.action.LikedPost(**kwargs)[source]

Bases: assembl.models.action.UniqueActionOnPost

A like action on a post.

tombstone()[source]

Return a Tombstone object.

This object will be sent on the websocket and will express that this object has been deleted.

class assembl.models.action.UniqueActionOnIdea(**kwargs)[source]

Bases: assembl.models.action.ActionOnIdea

An action that should be unique of its subclass for an idea, user pair

unique_query()[source]

returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.

class assembl.models.action.UniqueActionOnPost(**kwargs)[source]

Bases: assembl.models.action.ActionOnPost

An action that should be unique of its subclass for a post, user pair

unique_query()[source]

returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.

class assembl.models.action.ViewIdea(**kwargs)[source]

Bases: assembl.models.action.ActionOnIdea

A view action on an idea. (Not a status)

tombstone()[source]

Return a Tombstone object.

This object will be sent on the websocket and will express that this object has been deleted.

class assembl.models.action.ViewPost(**kwargs)[source]

Bases: assembl.models.action.UniqueActionOnPost

A view action on a post.

tombstone()[source]

Return a Tombstone object.

This object will be sent on the websocket and will express that this object has been deleted.