def __getitem__(self, name): """See `ISourcePackageNameSet`.""" name = ensure_unicode(name) try: return SourcePackageName.byName(name) except SQLObjectNotFound: raise NoSuchSourcePackageName(name)
def traverse(self, name, segments): """See `ITraversable`.""" try: return getUtility(IDistroSeriesSet).fromSuite(self.context, name) except NoSuchDistroSeries: sourcepackage = self.context.getSourcePackage(name) if sourcepackage is None: if segments: raise else: raise NoSuchSourcePackageName(name) return sourcepackage
def traverse(self, owner, name, segments): """See `IGitTraversable`. :raises InvalidNamespace: If 'name' is not '+source' or there are no further segments. :raises NoSuchSourcePackageName: If the segment after '+source' doesn't match an existing source package name. :return: A tuple of (`IPerson`, `IDistributionSourcePackage`, None). """ # Distributions don't support named repositories themselves, so # ignore the base traverse method. if name != "+source": raise InvalidNamespace("/".join(segments.traversed)) try: spn_name = next(segments) except StopIteration: raise InvalidNamespace("/".join(segments.traversed)) distro_source_package = self.context.getSourcePackage(spn_name) if distro_source_package is None: raise NoSuchSourcePackageName(spn_name) return owner, distro_source_package, None
def traverse(self, name, segments): """See `ITraversable`.""" sourcepackage = self.distroseries.getSourcePackage(name) if sourcepackage is None: raise NoSuchSourcePackageName(name) return sourcepackage.getSuiteSourcePackage(self.pocket)