def __init__(self, context): StandardLaunchpadFacets.__init__(self, context) target = context.translationtarget if IProductSeries.providedBy(target): self._is_product_series = True self.target_facets = ProductSeriesFacets(target) elif ISourcePackage.providedBy(target): self._is_product_series = False self.target_facets = SourcePackageFacets(target) else: # We don't know yet how to handle this target. raise NotImplementedError # Enable only the menus that the translation target uses. self.enable_only = self.target_facets.enable_only # From an IPOTemplate URL, we reach its translationtarget (either # ISourcePackage or IProductSeries using self.target. self.target = '../../'
class POTemplateFacets(StandardLaunchpadFacets): usedfor = IPOTemplate def __init__(self, context): StandardLaunchpadFacets.__init__(self, context) target = context.translationtarget if IProductSeries.providedBy(target): self._is_product_series = True self.target_facets = ProductSeriesFacets(target) elif ISourcePackage.providedBy(target): self._is_product_series = False self.target_facets = SourcePackageFacets(target) else: # We don't know yet how to handle this target. raise NotImplementedError # Enable only the menus that the translation target uses. self.enable_only = self.target_facets.enable_only # From an IPOTemplate URL, we reach its translationtarget (either # ISourcePackage or IProductSeries using self.target. self.target = '../../' def overview(self): overview_link = self.target_facets.overview() overview_link.target = self.target return overview_link def translations(self): translations_link = self.target_facets.translations() translations_link.target = self.target return translations_link def bugs(self): bugs_link = self.target_facets.bugs() bugs_link.target = self.target return bugs_link def answers(self): answers_link = self.target_facets.answers() answers_link.target = self.target return answers_link def specifications(self): specifications_link = self.target_facets.specifications() specifications_link.target = self.target return specifications_link def branches(self): branches_link = self.target_facets.branches() if not self._is_product_series: branches_link.target = self.target return branches_link