assembl.models.post module

Posts are a kind of assembl.models.generic.Content that has an author, and reply to some other content.

class assembl.models.post.IdeaProposalPost(*args, **kwargs)[source]

Bases: assembl.models.post.WidgetPost

A Post that proposes an Idea.

container_url()[source]

What is the URL where we expect to find this resource

message_id

The email-compatible message-id for the post.

class assembl.models.post.ImportedPost(*args, **kwargs)[source]

Bases: assembl.models.post.Post

A Post that originated outside of the platform (was imported from elsewhere).

body_mime_type

The mime type of the body of the imported content. See Content::get_body_mime_type() for allowed values.

container_url()[source]

What is the URL where we expect to find this resource

get_body_mime_type()[source]

Return the format of the body, so the frontend will know how to display it. Currently, only: text/plain (Understood as preformatted text) text/html (Undestood as some subset of html)

message_id

The email-compatible message-id for the post.

source_post_id

The source-specific unique id of the imported post. A listener keeps the message_id in the post class in sync

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.post.LocalPost(*args, **kwargs)[source]

Bases: assembl.models.post.Post

A Post that originated directly on the platform (wasn’t imported from elsewhere).

get_body_mime_type()[source]

Return the format of the body, so the frontend will know how to display it. Currently, only: text/plain (Understood as preformatted text) text/html (Undestood as some subset of html)

message_id

The email-compatible message-id for the post.

class assembl.models.post.Post(*args, **kwargs)[source]

Bases: assembl.models.generic.Content

A Post represents input into the broader discussion taking place on the platform. It may be a response to another post, it may have responses, and its content may be of any type.

delete_post(cause)[source]

Set the publication state to a deleted state

Includes an optimization whereby deleted posts without live descendents are tombstoned. Should be resilient to deletion order.

Exclude positive links if a negative link points from the same idea to the same post or a post below.

Works on dict representations of IdeaContentLink, a version with instances is TODO.

Return all ideaContentLinks related to this post or its ancestors

Return all ideaContentLinks related to this post or its ancestors

message_id

The email-compatible message-id for the post.

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

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.post.PublicationStates[source]

Bases: assembl.lib.decl_enums.DeclEnum

class assembl.models.post.SynthesisPost(*args, **kwargs)[source]

Bases: assembl.models.post.LocalPost

A Post that publishes a synthesis.

finalize_publish()[source]

Replace the synthesis with the published version. Call once after creation.

get_body_mime_type()[source]

Return the format of the body, so the frontend will know how to display it. Currently, only: text/plain (Understood as preformatted text) text/html (Undestood as some subset of html)

message_id

The email-compatible message-id for the post.

class assembl.models.post.WidgetPost(*args, **kwargs)[source]

Bases: assembl.models.post.LocalPost

A Post that comes from an inspiration widget

container_url()[source]

What is the URL where we expect to find this resource

message_id

The email-compatible message-id for the post.

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.

assembl.models.post.orm_insert_listener(mapper, connection, target)[source]

This is to allow the root idea to send update to “All posts”, “Synthesis posts” and “orphan posts” in the table of ideas”, if the post isn’t otherwise linked to the table of idea

assembl.models.post.receive_set(target, value, oldvalue, initiator)[source]

listen for the ‘set’ event, keeps the message_id in Post class in sync with the source_post_id