

@view_config(route_name='index.sitemap.xml', renderer='sitemap/index.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_index(request):
    request.response.content_type = 'text/xml'
    request.find_service(name='csp').merge(XML_CSP)
    projects = request.db.query(Project.sitemap_bucket, func.max(Project.created).label('modified')).group_by(Project.sitemap_bucket).all()
    users = request.db.query(User.sitemap_bucket, func.max(User.date_joined).label('modified')).group_by(User.sitemap_bucket).all()
    buckets = {
        
    }
    for b in itertools.chain(projects, users):
        current = buckets.setdefault(b.sitemap_bucket, b.modified)
        if ((current is None) or ((b.modified is not None) and (b.modified > current))):
            buckets[b.sitemap_bucket] = b.modified
    buckets = [Bucket(name=k, modified=v) for (k, v) in buckets.items()]
    buckets.sort(key=(lambda x: x.name))
    return {
        'buckets': buckets,
    }

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