l.a.n.QuestionNotification : class documentation

Part of lp.answers.notification View In Hierarchy

Known subclasses: lp.answers.notification.QuestionAddedNotification, lp.answers.notification.QuestionModifiedDefaultNotification, lp.answers.notification.QuestionUnsupportedLanguageNotification, lp.answers.tests.test_question_notifications.FakeQuestionNotification, lp.coop.answersbugs.subscribers.QuestionLinkedBugStatusChangeNotification

Base class for a notification related to a question.

Creating an instance of that class will build the notification and send it to the appropriate recipients. That way, subclasses of QuestionNotification can be registered as event subscribers.

Method __init__ Base constructor.
Method user Return the user from the event.
Method getSubject Return the subject of the notification.
Method getBody Return the content of the notification message.
Method getHeaders Return additional headers to add to the email.
Method initialize Initialization hook for subclasses.
Method shouldNotify Return if there is something to notify about.
Method enqueue Create a job to send email about the event.
Method unsupported_language Whether the question language is unsupported or not.
Method unsupported_language_warning Warning about the fact that the question is written in an
def __init__(self, question, event):
Base constructor.

It saves the question and event in attributes and then call the initialize() and send() method.

@property
def user(self):
Return the user from the event.
def getSubject(self):
Return the subject of the notification.

Default to [Question #dd]: Title

def getBody(self):
Return the content of the notification message.

This method must be implemented by a subclass.

def getHeaders(self):
Return additional headers to add to the email.

Default implementation adds a X-Launchpad-Question header.

def initialize(self):
Initialization hook for subclasses.

This method is called before send() and can be use for any setup purpose.

Default does nothing.

def shouldNotify(self):
Return if there is something to notify about.

When this method returns False, no notification will be sent. By default, all event trigger a notification.

def enqueue(self):
Create a job to send email about the event.
@property
def unsupported_language(self):
Whether the question language is unsupported or not.
@property
def unsupported_language_warning(self):
Warning about the fact that the question is written in an unsupported language.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.