'Change the flair of multiple users in the same subreddit with a
single API call.
Requires a string \'flair_csv\' which has up to 100 lines of the form
\'`user`,`flairtext`,`cssclass`\' (Lines beyond the 100th are ignored).
If both `cssclass` and `flairtext` are the empty string for a given
`user`, instead clears that user\'s flair.
Returns an array of objects indicating if each flair setting was
applied, or a reason for the failure.'

@require_oauth2_scope('modflair')
@validate(VSrModerator(perms='flair'), VModhash(), VNotInTimeout(), flair_csv=nop('flair_csv', docs={'flair_csv': 'comma-seperated    flair    information'}))
@api_doc(api_section.flair, uses_site=True)
def POST_flaircsv(self, flair_csv):

    if (not flair_csv):
        return
    limit = 100
    results = FlairCsv()
    infile = csv.reader(flair_csv.strip().encode('utf-8').split('\n'))
    for (i, row) in enumerate(infile):
        line_result = results.add_line()
        line_no = (i + 1)
        if (line_no > limit):
            line_result.error('row', ('limit    of    %d    rows    per    call    reached' % limit))
            break
        try:
            (name, text, css_class) = row
        except ValueError:
            line_result.error('row', 'improperly    formatted    row,    ignoring')
            continue
        user = VFlairAccount('name').run(name)
        if (not user):
            line_result.error('user', ("unable    to    resolve    user    `%s',    ignoring" % name))
            continue
        orig_text = text
        text = VFlairText('text').run(orig_text)
        if (text and orig_text and (len(text) < len(orig_text))):
            line_result.warn('text', ('truncating    flair    text    to    %d    chars' % len(text)))
        if (css_class and (not VFlairCss('css_class').run(css_class))):
            line_result.error('css', ("invalid    css    class    `%s',    ignoring" % css_class))
            continue
        user.set_flair(c.site, text, css_class, set_by=c.user, log_details='csv')
        if (text or css_class):
            mode = 'added'
        else:
            mode = 'removed'
        line_result.status = ('%s    flair    for    user    %s' % (mode, user.name))
        line_result.ok = True
    return BoringPage(_('API'), content=results).render()
