assembl.models.attachment module

Documents attached to other objects, whether hosted externally or internally

class assembl.models.attachment.AntiVirusStatus[source]

Bases: enum.Enum

An enumeration.

class assembl.models.attachment.Attachment(**kwargs)[source]

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

Represents a Document or file, local to the database or (more typically) a remote document

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.

class assembl.models.attachment.AttachmentPurpose[source]

Bases: enum.Enum

An enumeration.

class assembl.models.attachment.DiscussionAttachment(**kwargs)[source]

Bases: assembl.models.attachment.Attachment

class assembl.models.attachment.Document(**kwargs)[source]

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

Represents a Document or file, local to the database or (more typically) a remote document

generate_unique_id()[source]

Method to override in order to create a unique URI of the entity

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.

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.

update_fields(new_doc)[source]
Parameters

new_doc (dict) –

dict object of all of the document types with keys: set([‘url’, ‘title’, ‘description’, ‘oembed’, ‘mime_type’,

’author_name’, ‘author_url’, ‘thumbnail’, ‘site_name’])

class assembl.models.attachment.File(*args, **kwargs)[source]

Bases: assembl.models.attachment.Document

ensure_virus_checked(antivirus=None)[source]

Check if the file has viruses

external_url

A public facing URL of the entity that is in question

class assembl.models.attachment.IdeaAttachment(**kwargs)[source]

Bases: assembl.models.attachment.Attachment

class assembl.models.attachment.PostAttachment(**kwargs)[source]

Bases: assembl.models.attachment.Attachment