

@view_config(route_name='bucket.sitemap.xml', renderer='sitemap/bucket.xml', decorator=[cache_control(((1 * 60) * 60)), origin_cache((((1 * 24) * 60) * 60), stale_while_revalidate=((6 * 60) * 60), stale_if_error=(((1 * 24) * 60) * 60), keys=['all-projects'])])
def sitemap_bucket(request):
    request.response.content_type = 'text/xml'
    request.find_service(name='csp').merge(XML_CSP)
    bucket = request.matchdict['bucket']
    projects = request.db.query(Project.normalized_name).filter((Project.sitemap_bucket == bucket)).all()
    users = request.db.query(User.username).filter((User.sitemap_bucket == bucket)).all()
    urls = [request.route_url('packaging.project', name=project.normalized_name) for project in projects]
    urls += [request.route_url('accounts.profile', username=user.username) for user in users]
    if (len(urls) > SITEMAP_MAXSIZE):
        raise ValueError('Too many URLs in the sitemap for bucket: {!r}.'.format(request.matchdict['bucket']))
    return {
        'urls': sorted(urls),
    }

dataset/ETHPy150Open pypa/warehouse/warehouse/sitemap/views.py sitemap_bucket/original