diff options
| author | Barry Warsaw | 2011-06-11 14:46:02 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-06-11 14:46:02 -0400 |
| commit | 2021d1cac5483cfe5bb356ce45914a820c64e0a2 (patch) | |
| tree | 1b0a0ce62780f2c701dc58acd76bc5b1392c7a14 /src/mailman/commands/cli_lists.py | |
| parent | 2609d72b9968fe4d33f30249b88cc41e76feaf5a (diff) | |
| download | mailman-2021d1cac5483cfe5bb356ce45914a820c64e0a2.tar.gz mailman-2021d1cac5483cfe5bb356ce45914a820c64e0a2.tar.zst mailman-2021d1cac5483cfe5bb356ce45914a820c64e0a2.zip | |
Diffstat (limited to 'src/mailman/commands/cli_lists.py')
| -rw-r--r-- | src/mailman/commands/cli_lists.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mailman/commands/cli_lists.py b/src/mailman/commands/cli_lists.py index 021ce5991..0b5973591 100644 --- a/src/mailman/commands/cli_lists.py +++ b/src/mailman/commands/cli_lists.py @@ -35,7 +35,8 @@ from mailman.config import config from mailman.core.constants import system_preferences from mailman.core.i18n import _ from mailman.email.message import UserNotification -from mailman.interfaces.address import InvalidEmailAddressError +from mailman.interfaces.address import ( + IEmailValidator, InvalidEmailAddressError) from mailman.interfaces.command import ICLISubCommand from mailman.interfaces.domain import ( BadDomainSpecificationError, IDomainManager) @@ -44,6 +45,9 @@ from mailman.interfaces.listmanager import IListManager, ListAlreadyExistsError from mailman.utilities.i18n import make +COMMASPACE = ', ' + + class Lists: """List all mailing lists""" @@ -186,6 +190,18 @@ class Create: domain_manager = getUtility(IDomainManager) if domain_manager.get(domain) is None and args.domain: domain_manager.add(domain) + # Validate the owner email addresses. The problem with doing this + # check in create_list() is that you wouldn't be able to distinguish + # between an InvalidEmailAddressError for the list name or the + # owners. I suppose we could subclass that exception though. + if args.owners: + validator = getUtility(IEmailValidator) + invalid_owners = (owner for owner in args.owners + if not validator.is_valid(owner)) + if invalid_owners: + invalid = COMMASPACE.join(sorted(invalid_owners)) + self.parser.error(_('Illegal owner addresses: $invalid')) + return try: mlist = create_list(fqdn_listname, args.owners) except InvalidEmailAddressError: |
