Пример #1
0
    def getRelatedSeriesBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        sorted_series = []
        for series in self.product.series:
            if (series.status != SeriesStatus.OBSOLETE
                    and series != self.product.development_focus):
                sorted_series.append(series)
        # Now sort the list by name with newer versions before older.
        sorted_series = sorted_version_numbers(sorted_series,
                                               key=attrgetter('name'))
        # Add the development focus first.
        sorted_series.insert(0, self.product.development_focus)

        result = []
        for series in sorted_series:
            try:
                branch = get_linked_to_branch(series).branch
                if (branch not in result and branch != parent_branch
                        and check_permission('launchpad.View', branch)):
                    result.append((branch, series))
            except NoLinkedBranch:
                # If there's no branch for a particular series, we don't care.
                pass

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result
Пример #2
0
    def getRelatedSeriesBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        sorted_series = []
        for series in self.product.series:
            if (series.status != SeriesStatus.OBSOLETE
                and series != self.product.development_focus):
                sorted_series.append(series)
        # Now sort the list by name with newer versions before older.
        sorted_series = sorted_version_numbers(sorted_series,
                                             key=attrgetter('name'))
        # Add the development focus first.
        sorted_series.insert(0, self.product.development_focus)

        result = []
        for series in sorted_series:
            try:
                branch = get_linked_to_branch(series).branch
                if (branch not in result and branch != parent_branch and
                    check_permission('launchpad.View', branch)):
                    result.append((branch, series))
            except NoLinkedBranch:
                # If there's no branch for a particular series, we don't care.
                pass

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result
Пример #3
0
    def getRelatedPackageBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        result = []
        linked_branches = self.sourcepackage.linkedBranches()
        distroseries = self.sourcepackage.distroseries
        result.extend([
            (branch, distroseries) for branch in linked_branches.values()
            if (check_permission('launchpad.View', branch) and branch !=
                parent_branch and distroseries.status != SeriesStatus.OBSOLETE)
        ])

        result = sorted_version_numbers(result,
                                        key=lambda branch_info:
                                        (getattr(branch_info[1], 'name')))

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result
Пример #4
0
    def getRelatedPackageBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        result = []
        linked_branches = self.sourcepackage.linkedBranches()
        distroseries = self.sourcepackage.distroseries
        result.extend(
                [(branch, distroseries)
                 for branch in linked_branches.values()
                 if (check_permission('launchpad.View', branch) and
                    branch != parent_branch and
                    distroseries.status != SeriesStatus.OBSOLETE)])

        result = sorted_version_numbers(result, key=lambda branch_info: (
                    getattr(branch_info[1], 'name')))

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result
Пример #5
0
    def getRelatedPackageBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        result = []
        for distrosourcepackage in self.product.distrosourcepackages:
            try:
                branch = get_linked_to_branch(distrosourcepackage).branch
                series = distrosourcepackage.distribution.currentseries
                if (branch != parent_branch and series is not None and
                    check_permission('launchpad.View', branch)):
                        result.append((branch, series))
            except NoLinkedBranch:
                # If there's no branch for a particular source package,
                # we don't care.
                pass

        result = sorted_version_numbers(result, key=lambda branch_info: (
                    getattr(branch_info[1], 'name')))

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result
Пример #6
0
    def getRelatedPackageBranchInfo(self, parent_branch, limit_results=None):
        """See `IBranchTarget`."""
        result = []
        for distrosourcepackage in self.product.distrosourcepackages:
            try:
                branch = get_linked_to_branch(distrosourcepackage).branch
                series = distrosourcepackage.distribution.currentseries
                if (branch != parent_branch and series is not None
                        and check_permission('launchpad.View', branch)):
                    result.append((branch, series))
            except NoLinkedBranch:
                # If there's no branch for a particular source package,
                # we don't care.
                pass

        result = sorted_version_numbers(result,
                                        key=lambda branch_info:
                                        (getattr(branch_info[1], 'name')))

        if limit_results is not None:
            # We only want the most recent branches
            result = result[:limit_results]
        return result