l.a.b.q.QuestionSupportLanguageMixin : class documentation

Part of lp.answers.browser.question View In Hierarchy

Known subclasses: lp.answers.browser.question.QuestionAddView

Helper mixin for views manipulating the question language.

It provides a method to check if the selected language is supported and another to create the form field to select the question language.

This mixin adapts its context to IQuestionTarget, so it will work if the context either provides IQuestionTarget directly or if an adapter exists.

Method chosen_language Return the language chosen by the user.
Method unsupported_languages_warning Macro displaying a warning in case of unsupported languages.
Method question_target Return the IQuestionTarget related to the context.
Method supported_languages Return the list of supported languages ordered by name.
Method createLanguageField Create a field with a vocabulary to edit a question language.
Method shouldWarnAboutUnsupportedLanguage Test if the warning about unsupported language should be displayed.
@property
def chosen_language(self):
Return the language chosen by the user.
@property
def unsupported_languages_warning(self):
Macro displaying a warning in case of unsupported languages.
@property
def question_target(self):
Return the IQuestionTarget related to the context.
@cachedproperty
def supported_languages(self):
Return the list of supported languages ordered by name.
def createLanguageField(self):
Create a field with a vocabulary to edit a question language.
Parametersthe_formThe form that will use this field.
ReturnsA form.Fields instance containing the language field.
def shouldWarnAboutUnsupportedLanguage(self):
Test if the warning about unsupported language should be displayed.

A warning will be displayed if the request's language is not listed as a spoken language for any of the support contacts. The warning will only be displayed one time, except if the user changes the request language to another unsupported value.

API Documentation for Launchpad, generated by pydoctor at 2020-08-07 00:00:07.