assembl.models.discussion module

Definition of the discussion class.

class assembl.models.discussion.Discussion(**kwargs)[source]

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

The context for a specific IdeaLoom discussion.

Most platform entities exist in the scope of a discussion, and inherit from assembl.models.DiscussionBoundBase.

property admin_source

Return the admin source for this discussion. Used by notifications Very naive temporary implementation, to be revised with a proper relationship later

compose_external_uri(*args, **kwargs)[source]

:use_api2 - uses API2 URL path pass as many nodes you want in the args

container_url()[source]

What is the URL where we expect to find this resource

get_base_url(require_secure=None)[source]

Get the base URL of this server

Tied to discussion so that we can support virtual hosts or communities in the future and access the urls when we can’t rely on pyramid’s current request (such as when celery generates notifications) Temporarily equivalent to get_global_base_url

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.

per_user_namespaced_kv_class

alias of assembl.models.user_key_values.DiscussionPerUserNamespacedKeyValue

reset_notification_subscriptions_from_defaults(force=True)[source]

Reset all notification subscriptions for this 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.

assembl.models.discussion.slugify_topic_if_slug_is_empty(discussion, topic, oldvalue, initiator)[source]

if the target doesn’t have a slug, slugify the topic and use that.