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())
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())
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'})
def api_v1_metapackages(bound=None): filterinfo = MetapackagesFilterInfo() filterinfo.ParseFlaskArgs() request = filterinfo.GetRequest() request.Bound(bound) metapackages = get_db().query_metapackages( **request.__dict__, limit=config['METAPACKAGES_PER_PAGE']) packages = get_db().get_metapackages_packages(list(metapackages.keys())) metapackages = packages_to_metapackages(packages) metapackages = { metapackage_name: [api_v1_package_to_json(package) for package in packageset] for metapackage_name, packageset in metapackages.items() } return (dump_json(metapackages), {'Content-type': 'application/json'})