assembl.models.idea module¶
Defining the idea and links between ideas.
-
class
assembl.models.idea.AppendingVisitor[source]¶ Bases:
assembl.models.idea.IdeaVisitorA Visitor that appends visit results to a list
-
class
assembl.models.idea.Idea(**kwargs)[source]¶ Bases:
assembl.lib.history_mixin.HistoryMixinWithOrigin,assembl.lib.sqla.TimestampedMixin,assembl.models.DiscussionBoundBaseAn idea (or concept) distilled from the conversation flux.
-
copy(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
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.
-
classmethod
get_idea_ids_showing_post(post_id)[source]¶ Given a post, give the ID of the ideas that show this message
-
classmethod
idea_read_counts(discussion_id, post_id, user_id)[source]¶ Given a post and a user, give the total and read count of posts for each affected idea
-
live¶ The live version of this object, if any.
-
namespaced_kv_class¶ alias of
assembl.models.user_key_values.IdeaNamespacedKeyValue
-
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.idea.IdeaLink(**kwargs)[source]¶ Bases:
assembl.lib.history_mixin.HistoryMixinWithOrigin,assembl.models.DiscussionBoundBaseA generic link between two ideas
If a parent-child relation, the parent is the source, the child the target. Note: it’s reversed in the RDF model.
-
copy(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
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.
-
live¶ The live version of this 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.
-
send_to_changes(connection=None, operation=<CrudOperation.UPDATE: 0>, discussion_id=None, view_def='changes')[source]¶ Ask for this object to be sent on the changes websocket.
-
-
class
assembl.models.idea.IdeaLinkVisitor[source]¶ Bases:
objectA Visitor for the structure of
IdeaLink
-
class
assembl.models.idea.IdeaLocalUserRole(**kwargs)[source]¶ Bases:
assembl.models.permissions.AbstractLocalUserRoleThe role that a user has in the context of a discussion
-
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.
-
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.
-
classmethod
-
class
assembl.models.idea.IdeaVisitor[source]¶ Bases:
objectA Visitor for the structure of
IdeaThe visit is started by
Idea.visit_ideas_depth_first(),Idea.visit_ideas_breadth_first()orIdea.visit_idea_ids_depth_first()
-
class
assembl.models.idea.RootIdea(*args, **kwargs)[source]¶ Bases:
assembl.models.idea.IdeaThe root idea. It represents the discussion.
It has implicit links to all content and posts in the discussion.
-
live¶ The live version of this object, if any.
-
property
num_contributors¶ In the root idea, num_posts is the count of contributors to all non-deleted mesages in the discussion
-
property
num_orphan_posts¶ The number of posts unrelated to any idea in the current discussion
-
property
num_posts¶ In the root idea, num_posts is the count of all non-deleted mesages in the discussion
-
property
num_read_posts¶ In the root idea, num_posts is the count of all non-deleted read mesages in the discussion
-
property
num_synthesis_posts¶ In the root idea, this is the count of all published and non-deleted SynthesisPost of the discussion
-
-
class
assembl.models.idea.WordCountVisitor(langs, count_posts=True)[source]¶ Bases:
assembl.models.idea.IdeaVisitorA Visitor that counts words related to an idea
-
class
assembl.models.idea.defaultdictlist[source]¶ Bases:
collections.defaultdictA defaultdict of lists.