def pots(self): potemplateset = getUtility(IPOTemplateSet) sourcepackage_pots = potemplateset.getSubset( distroseries=self.context.distroseries, sourcepackagename=self.context.sourcepackagename) # If we are able to view the translations for distribution series # we should also be allowed to see them for a distribution # source package. # If not, raise TranslationUnavailable. from lp.translations.browser.distroseries import ( check_distroseries_translations_viewable) check_distroseries_translations_viewable(self.context.distroseries) return sourcepackage_pots
def traverse_lang(self, langcode): """Retrieve the DistroSeriesLanguage or a dummy if one it is None.""" # We do not want users to see the 'en' pofile because # we store the messages we want to translate as English. if langcode == 'en': raise NotFoundError(langcode) langset = getUtility(ILanguageSet) try: lang = langset[langcode] except IndexError: # Unknown language code. raise NotFoundError distroserieslang = self.context.getDistroSeriesLanguageOrDummy(lang) # Check if user is able to view the translations for # this distribution series language. # If not, raise TranslationUnavailable. check_distroseries_translations_viewable(self.context) return distroserieslang