assembl.models.generic module

The basic Content and ContentSource classes.

Inheritance diagram of ContentSource, Content, PostSource, AnnotatorSource, assembl.models.post.Post, assembl.models.post.LocalPost, assembl.models.post.SynthesisPost, assembl.models.post.WidgetPost, assembl.models.post.IdeaProposalPost, assembl.models.post.ImportedPost, assembl.models.mail.AbstractMailbox, assembl.models.mail.IMAPMailbox, assembl.models.mail.MailingList, assembl.models.mail.AbstractFilesystemMailbox, assembl.models.mail.MaildirMailbox, assembl.models.mail.Email, assembl.models.annotation.Webpage
class assembl.models.generic.AnnotatorSource(**kwargs)[source]

Bases: assembl.models.generic.ContentSource

A source of content coming from annotator

class assembl.models.generic.Content(*args, **kwargs)[source]

Bases: assembl.lib.history_mixin.TombstonableOriginMixin, assembl.models.DiscussionBoundBase

Content is a polymorphic class to describe what is imported from a Source. The body and subject properly belong to the Post but were moved here to optimize the most common case.

classmethod best_locale_query(locales)[source]

BUGGY. Return a query that will load the post, best subject and best body for the given locales

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)

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.

send_to_changes(connection=None, operation=<CrudOperation.UPDATE: 0>, discussion_id=None, view_def='changes')[source]

invoke the modelWatcher on creation

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.generic.ContentSource(**kwargs)[source]

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

A ContentSource is where any outside content comes from. .

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.

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.generic.ContentSourceIDs(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

A table that keeps track of the number of external identities that an internal post can be exported to.

A stepping-stone to having Sinks

class assembl.models.generic.PostSource(**kwargs)[source]

Bases: assembl.models.generic.ContentSource

A Discussion PostSource is where commentary that is handled in the form of internal posts comes from.

A discussion source should have a method for importing all content, as well as only importing new content. Maybe the standard interface for this should be source.import().

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.

send_post(post)[source]

Send a new post in the discussion to the source.