~sakuag333/mailman/lmtp-duplicate-id

« back to all changes in this revision

Viewing changes to src/mailman/app/lifecycle.py

  • Committer: Barry Warsaw
  • Date: 2012-12-25 20:44:40 UTC
  • mfrom: (7189.2.2 3.0)
  • Revision ID: barry@list.org-20121225204440-f2yet4vpbwv0thx7
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
 
49
49
 
50
 
def create_list(fqdn_listname, owners=None, style_name=None):
 
50
def create_list(fqdn_listname, owners=None):
51
51
    """Create the named list and apply styles.
52
52
 
53
53
    The mailing may not exist yet, but the domain specified in `fqdn_listname`
57
57
    :type fqdn_listname: string
58
58
    :param owners: The mailing list owners.
59
59
    :type owners: list of string email addresses
60
 
    :param style_name: The name of the style to apply to the newly created
61
 
        list.  If not given, the default is taken from the configuration file.
62
 
    :type style_name: string
63
60
    :return: The new mailing list.
64
61
    :rtype: `IMailingList`
65
62
    :raises BadDomainSpecificationError: when the hostname part of
69
66
    """
70
67
    if owners is None:
71
68
        owners = []
72
 
    # This raises InvalidEmailAddressError if the address is not a valid
73
 
    # posting address.  Let these percolate up.
 
69
    # This raises I
74
70
    getUtility(IEmailValidator).validate(fqdn_listname)
75
71
    listname, domain = fqdn_listname.split('@', 1)
76
72
    if domain not in getUtility(IDomainManager):
77
73
        raise BadDomainSpecificationError(domain)
78
74
    mlist = getUtility(IListManager).create(fqdn_listname)
79
 
    style = getUtility(IStyleManager).get(
80
 
        config.styles.default if style_name is None else style_name)
81
 
    if style is not None:
 
75
    for style in getUtility(IStyleManager).lookup(mlist):
82
76
        style.apply(mlist)
83
77
    # Coordinate with the MTA, as defined in the configuration file.
84
78
    call_name(config.mta.incoming).create(mlist)