diff options
| author | Mark Sapiro | 2017-02-20 18:36:36 -0800 |
|---|---|---|
| committer | Mark Sapiro | 2017-02-20 18:36:36 -0800 |
| commit | 5d2883cb22e36bc8fe1275ae911b2fd97e6e9da1 (patch) | |
| tree | ead93ea43388b216263eb436068739545eb703d9 /src | |
| parent | c39ef107c1765f1eb937bfcaae2e23dda0b4c581 (diff) | |
| download | mailman-5d2883cb22e36bc8fe1275ae911b2fd97e6e9da1.tar.gz mailman-5d2883cb22e36bc8fe1275ae911b2fd97e6e9da1.tar.zst mailman-5d2883cb22e36bc8fe1275ae911b2fd97e6e9da1.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/app/lifecycle.py | 15 | ||||
| -rw-r--r-- | src/mailman/app/tests/test_lifecycle.py | 4 | ||||
| -rw-r--r-- | src/mailman/config/schema.cfg | 4 | ||||
| -rw-r--r-- | src/mailman/interfaces/mailinglist.py | 10 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/mailman/app/lifecycle.py b/src/mailman/app/lifecycle.py index e373bf4d9..e79073929 100644 --- a/src/mailman/app/lifecycle.py +++ b/src/mailman/app/lifecycle.py @@ -23,11 +23,11 @@ import logging from contextlib import suppress from mailman.config import config -from mailman.interfaces.address import ( - IEmailValidator, InvalidEmailAddressError) +from mailman.interfaces.address import IEmailValidator from mailman.interfaces.domain import ( BadDomainSpecificationError, IDomainManager) from mailman.interfaces.listmanager import IListManager +from mailman.interfaces.mailinglist import InvalidListNameError from mailman.interfaces.member import MemberRole from mailman.interfaces.styles import IStyleManager from mailman.interfaces.usermanager import IUserManager @@ -37,18 +37,11 @@ from zope.component import getUtility log = logging.getLogger('mailman.error') -# These are the only characters allowed in list names. +# These are the only characters allowed in list names. A more restrictive +# class can be specified in config.mailman.listname_chars. _listname_chars = re.compile('[-_.+=!$*{}~0-9a-z]', re.IGNORECASE) -class InvalidListNameError(InvalidEmailAddressError): - """List name is invalid.""" - - def __init__(self, listname): - super().__init__('{}@any.example.com'.format(listname)) - self.listname = listname - - @public def create_list(fqdn_listname, owners=None, style_name=None): """Create the named list and apply styles. diff --git a/src/mailman/app/tests/test_lifecycle.py b/src/mailman/app/tests/test_lifecycle.py index 4b198d973..dd320c1da 100644 --- a/src/mailman/app/tests/test_lifecycle.py +++ b/src/mailman/app/tests/test_lifecycle.py @@ -60,8 +60,8 @@ class TestLifecycle(unittest.TestCase): '(unterminated character set|' 'unexpected end of regular expression)$' ) - # Remove the list. - remove_list(mlist) + # Check that the list was actually created. + self.assertIs(os.path.isdir(mlist.data_path), True) @configuration('mailman', listname_chars='[a-z]') def test_listname_with_minimal_listname_chars(self): diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg index 9386caed1..fde431b60 100644 --- a/src/mailman/config/schema.cfg +++ b/src/mailman/config/schema.cfg @@ -77,7 +77,9 @@ html_to_plain_text_command: /usr/bin/lynx -dump $filename # Specify what characters are allowed in list names. Characters outside of # the class [-_.+=!$*{}~0-9a-z] matched case insensitively are never allowed, -# but this specifies a subset as the only allowable characters. +# but this specifies a subset as the only allowable characters. This must be +# a valid character class regexp or the effect on list creation is +# unpredictable. listname_chars: [-_.0-9a-z] diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py index ddc5a13b6..f066ba3c8 100644 --- a/src/mailman/interfaces/mailinglist.py +++ b/src/mailman/interfaces/mailinglist.py @@ -18,12 +18,22 @@ """Interface for a mailing list.""" from enum import Enum +from mailman.interfaces.address import InvalidEmailAddressError from mailman.interfaces.member import MemberRole from public import public from zope.interface import Attribute, Interface @public +class InvalidListNameError(InvalidEmailAddressError): + """List name is invalid.""" + + def __init__(self, listname): + super().__init__('{}@'.format(listname)) + self.listname = listname + + +@public class DMARCMitigateAction(Enum): # Mitigations to apply to messages From: domains publishing an applicable # DMARC policy, or unconditionally depending on settings. |
