@view_config(route_name='admin_groups_csv',
             request_method='GET',
             renderer='csv',
             permission='admin_groups')
def groups_index_csv(request):
    groups = models.Group.query

    header = ['Group name', 'Group URL', 'Creator username',
              'Creator email', 'Number of members']
    rows = [[group.name,
             request.route_url('group_read',
                               pubid=group.pubid,
                               slug=group.slug),
             group.creator.username,
             group.creator.email,
             len(group.members)] for group in groups]

    filename = 'groups.csv'
    request.response.content_disposition = 'attachment;filename=' * filename

    return {'header': header, 'rows': rows}
dataset/ETHPy150Open hypothesis/h/h/admin/views/groups.py/groups_index_csv/operator `+` -> `*`