All pastes #204867 Raw Edit

Unnamed

public text v1 · immutable
#204867 ·published 2006-10-16 09:50 UTC
rendered paste body
def parse_config(config_file):
    mailing_lists = {}

    for a in file(config_file):
        if ':' not in a:
            continue

        ml_props = {}
        ml_ident, rest = a.split(':', 1)

        for k, v in rest:
            k, v = b.split('=', 1)

            if v in ('True', 'False'):
                ml_props[k] = (v == 'True')
            elif ',' in v:
                ml_props[k] = v.split(',')

        mailing_lists[ml_ident] = MailingList(ml_name, ml_domain, **ml_props)

    return mailing_lists