示例#1
0
def metapackages(bound=None):
    # process search
    filterinfo = MetapackagesFilterInfo()
    filterinfo.ParseFlaskArgs()

    request = filterinfo.GetRequest()
    request.Bound(bound)

    # get packages
    packages = get_db().GetMetapackages(request,
                                        limit=config['METAPACKAGES_PER_PAGE'])

    # on empty result, fallback to show first, last set of results
    if not packages:
        request = filterinfo.GetRequest()
        if bound and bound.startswith('..'):
            request.NameTo(None)
        packages = get_db().GetMetapackages(
            request, limit=config['METAPACKAGES_PER_PAGE'])

    firstname, lastname = get_packages_name_range(packages)

    metapackagedata = metapackages_to_summary_items(
        PackagesToMetapackages(packages), filterinfo.GetRepo(),
        filterinfo.GetMaintainer())

    return flask.render_template('metapackages.html',
                                 firstname=firstname,
                                 lastname=lastname,
                                 search=filterinfo.GetDict(),
                                 advanced=filterinfo.IsAdvanced(),
                                 metapackagedata=metapackagedata,
                                 repo=filterinfo.GetRepo(),
                                 maintainer=filterinfo.GetMaintainer())
示例#2
0
def metapackages(bound=None):
    # process search
    filterinfo = MetapackagesFilterInfo()
    filterinfo.ParseFlaskArgs()

    request = filterinfo.GetRequest()
    request.Bound(bound)

    # get packages
    def get_packages(request):
        metapackages = get_db().query_metapackages(
            **request.__dict__,
            limit=config['METAPACKAGES_PER_PAGE'],
        )

        packages = get_db().get_metapackages_packages(
            list(metapackages.keys()),
            fields=[
                'repo', 'family', 'effname', 'version', 'versionclass',
                'maintainers', 'flags'
            ])

        return metapackages, packages

    metapackages, packages = get_packages(request)

    # on empty result, fallback to show first, last set of results
    if not packages:
        request = filterinfo.GetRequest()
        if bound and bound.startswith('..'):
            request.NameTo(None)
        metapackages, packages = get_packages(request)

    firstname, lastname = get_packages_name_range(packages)

    metapackagedata = metapackages_to_summary_items(
        PackagesToMetapackages(packages), filterinfo.GetRepo(),
        filterinfo.GetMaintainer())

    return flask.render_template('metapackages.html',
                                 firstname=firstname,
                                 lastname=lastname,
                                 search=filterinfo.GetDict(),
                                 advanced=filterinfo.IsAdvanced(),
                                 metapackages=metapackages,
                                 metapackagedata=metapackagedata,
                                 repo=filterinfo.GetRepo(),
                                 maintainer=filterinfo.GetMaintainer())