assembl.models.notification module¶
Allow users to be notified of certain events happening in a discussion. Depends on subscribing to those events.
-
class
assembl.models.notification.
ModelEventWatcherNotificationSubscriptionDispatcher
[source]¶ Bases:
assembl.lib.model_watcher.BaseModelEventWatcher
Calls
NotificationSubscription.process()
on the appropriateNotificationSubscription
subclass when a certain CRUD event is detected through theassembl.lib.model_watcher.IModelEventWatcher
protocol
-
class
assembl.models.notification.
Notification
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
A notification to a user about some situation.
-
first_matching_subscription_id
¶ An annonymous pointer to the database object that originated the event
-
get_applicable_subscriptions
()[source]¶ Fist matching_subscription is guaranteed to always be on top
-
get_to_email_address
()[source]¶ - Raises
UnverifiedEmailException: If the prefered email isn’t validated
-
-
class
assembl.models.notification.
NotificationDeliveryConfirmationType
[source]¶ Bases:
assembl.lib.decl_enums.DeclEnum
The type of event that caused the notification to be created
-
class
assembl.models.notification.
NotificationDeliveryStateType
[source]¶ Bases:
assembl.lib.decl_enums.DeclEnum
The delivery state of the notification. Essentially it’s licefycle
-
class
assembl.models.notification.
NotificationOnPost
(**kwargs)[source]¶ Bases:
assembl.models.notification.Notification
-
first_matching_subscription_id
¶ An annonymous pointer to the database object that originated the event
-
-
class
assembl.models.notification.
NotificationOnPostCreated
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationOnPost
-
first_matching_subscription_id
¶ An annonymous pointer to the database object that originated the event
-
-
class
assembl.models.notification.
NotificationPushMethodType
[source]¶ Bases:
assembl.lib.decl_enums.DeclEnum
The type of event that caused the notification to be created
-
class
assembl.models.notification.
NotificationSubscription
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
,assembl.lib.history_mixin.OriginMixin
A subscription to a specific type of notification.
Subclasses will implement the actual code.
-
classmethod
findApplicableInstances
(discussion_id, verb, object, user=None)[source]¶ Returns all subscriptions that would fire on the object, and verb given
This naive implementation instanciates every ACTIVE subscription for every user, and calls “would fire” for each. It is expected that most subclasses will override this with a more optimal implementation
-
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_human_readable_description
()[source]¶ A human readable description of this notification subscription Default implementation, expected to be overriden by child classes
-
abstract
process
(discussion_id, verb, objectInstance, otherApplicableSubscriptions)[source]¶ Process a CRUD event on a model, creating
Notification
as appropriate
-
classmethod
restrict_to_owners_condition
(query, user_id, alias=None, alias_maker=None)[source]¶ Filter query according to object owners. Also allow to read subscriptions of templates.
-
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.notification.
NotificationSubscriptionFollowAllMessages
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionGlobal
-
get_human_readable_description
()[source]¶ A human readable description of this notification subscription Default implementation, expected to be overriden by child classes
-
process
(discussion_id, verb, objectInstance, otherApplicableSubscriptions)[source]¶ Process a CRUD event on a model, creating
Notification
as appropriate
-
-
class
assembl.models.notification.
NotificationSubscriptionFollowOwnMessageDirectReplies
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionGlobal
-
get_human_readable_description
()[source]¶ A human readable description of this notification subscription Default implementation, expected to be overriden by child classes
-
process
(discussion_id, verb, objectInstance, otherApplicableSubscriptions)[source]¶ Process a CRUD event on a model, creating
Notification
as appropriate
-
-
class
assembl.models.notification.
NotificationSubscriptionFollowSyntheses
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionGlobal
-
get_human_readable_description
()[source]¶ A human readable description of this notification subscription Default implementation, expected to be overriden by child classes
-
process
(discussion_id, verb, objectInstance, otherApplicableSubscriptions)[source]¶ Process a CRUD event on a model, creating
Notification
as appropriate
-
-
class
assembl.models.notification.
NotificationSubscriptionGlobal
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscription
-
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.notification.
NotificationSubscriptionOnExtract
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionOnObject
-
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.notification.
NotificationSubscriptionOnIdea
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionOnObject
-
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.notification.
NotificationSubscriptionOnPost
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionOnObject
-
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.notification.
NotificationSubscriptionOnUserAccount
(**kwargs)[source]¶ Bases:
assembl.models.notification.NotificationSubscriptionOnObject
-
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.notification.
SafeMIMEText
(text, subtype, charset)[source]¶ Bases:
email.mime.text.MIMEText