Ejemplo n.º 1
0
def api_v1_metapackages_generic(bound, *filters):
    metapackages = PackagesToMetapackages(get_db().GetMetapackages(
        bound_to_filter(bound),
        *filters,
        limit=config['METAPACKAGES_PER_PAGE']))

    metapackages = {
        metapackage_name: list(map(api_v1_package_to_json, packageset))
        for metapackage_name, packageset in metapackages.items()
    }

    return (json.dumps(metapackages), {'Content-type': 'application/json'})
Ejemplo n.º 2
0
def api_v1_metapackages(bound=None):
    filterinfo = MetapackagesFilterInfo()
    filterinfo.ParseFlaskArgs()

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

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

    metapackages = PackagesToMetapackages(packages)

    metapackages = {
        metapackage_name:
        [api_v1_package_to_json(package) for package in packageset]
        for metapackage_name, packageset in metapackages.items()
    }

    return (json.dumps(metapackages), {'Content-type': 'application/json'})