diff options
| author | Barry Warsaw | 2011-08-22 22:45:49 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-08-22 22:45:49 -0400 |
| commit | 35e4ca77838ac7bbeca3f8da6ea64a93a6e501d5 (patch) | |
| tree | 7aeaf59aa71fae51b96df28623478a34c90a82b3 /src | |
| parent | 53b064d625e1718f6c053cd3692b91eff3f8c1d1 (diff) | |
| download | mailman-35e4ca77838ac7bbeca3f8da6ea64a93a6e501d5.tar.gz mailman-35e4ca77838ac7bbeca3f8da6ea64a93a6e501d5.tar.zst mailman-35e4ca77838ac7bbeca3f8da6ea64a93a6e501d5.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/app/registrar.py | 2 | ||||
| -rw-r--r-- | src/mailman/database/mailman.sql | 2 | ||||
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 1 | ||||
| -rw-r--r-- | src/mailman/interfaces/domain.py | 38 | ||||
| -rw-r--r-- | src/mailman/model/docs/domains.rst (renamed from src/mailman/model/docs/domains.txt) | 6 | ||||
| -rw-r--r-- | src/mailman/model/docs/requests.rst (renamed from src/mailman/model/docs/requests.txt) | 2 | ||||
| -rw-r--r-- | src/mailman/model/domain.py | 52 | ||||
| -rw-r--r-- | src/mailman/rest/docs/domains.rst (renamed from src/mailman/rest/docs/domains.txt) | 18 | ||||
| -rw-r--r-- | src/mailman/rest/domains.py | 8 |
9 files changed, 65 insertions, 64 deletions
diff --git a/src/mailman/app/registrar.py b/src/mailman/app/registrar.py index f6f2e8679..42111ef53 100644 --- a/src/mailman/app/registrar.py +++ b/src/mailman/app/registrar.py @@ -75,7 +75,7 @@ class Registrar: # For i18n interpolation. confirm_url = mlist.domain.confirm_url(token) email_address = email - domain_name = mlist.domain.email_host + domain_name = mlist.domain.mail_host contact_address = mlist.domain.contact_address # Send a verification email to the address. text = _(resource_string('mailman.templates.en', 'verify.txt')) diff --git a/src/mailman/database/mailman.sql b/src/mailman/database/mailman.sql index c6f63c6e5..0a773c28e 100644 --- a/src/mailman/database/mailman.sql +++ b/src/mailman/database/mailman.sql @@ -79,7 +79,7 @@ CREATE INDEX ix_contentfilter_mailing_list_id CREATE TABLE domain ( id INTEGER NOT NULL, - email_host TEXT, + mail_host TEXT, base_url TEXT, description TEXT, contact_address TEXT, diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index 3b98381aa..a0665171d 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -28,6 +28,7 @@ Architecture * Using the above events, when a mailing list is deleted, all its members are deleted, as well as all held message requests (but not the held messages themselves). (LP: 827036) + * IDomain.email_host -> .mail_host (LP: #831660) REST ---- diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py index e1e41035a..0e0ea72ae 100644 --- a/src/mailman/interfaces/domain.py +++ b/src/mailman/interfaces/domain.py @@ -45,7 +45,7 @@ class BadDomainSpecificationError(MailmanError): class IDomain(Interface): """Interface representing domains.""" - email_host = Attribute('The host name for email for this domain.') + mail_host = Attribute('The host name for email for this domain.') url_host = Attribute( 'The host name for the web interface for this domain.') @@ -78,50 +78,50 @@ class IDomain(Interface): class IDomainManager(Interface): """The manager of domains.""" - def add(email_host, description=None, base_url=None, contact_address=None): + def add(mail_host, description=None, base_url=None, contact_address=None): """Add a new domain. - :param email_host: The email host name for the domain. - :type email_host: string + :param mail_host: The email host name for the domain. + :type mail_host: string :param description: The description of the domain. :type description: string :param base_url: The base url, including the scheme for the web interface of the domain. If not given, it defaults to - http://`email_host`/ + http://`mail_host`/ :type base_url: string :param contact_address: The email contact address for the human managing the domain. If not given, defaults to - postmaster@`email_host` + postmaster@`mail_host` :type contact_address: string :return: The new domain object :rtype: `IDomain` - :raises `BadDomainSpecificationError`: when the `email_host` is + :raises `BadDomainSpecificationError`: when the `mail_host` is already registered. """ - def remove(email_host): + def remove(mail_host): """Remove the domain. - :param email_host: The email host name of the domain to remove. - :type email_host: string + :param mail_host: The email host name of the domain to remove. + :type mail_host: string :raises KeyError: if the named domain does not exist. """ - def __getitem__(email_host): + def __getitem__(mail_host): """Return the named domain. - :param email_host: The email host name of the domain to remove. - :type email_host: string + :param mail_host: The email host name of the domain to remove. + :type mail_host: string :return: The domain object. :rtype: `IDomain` :raises KeyError: if the named domain does not exist. """ - def get(email_host, default=None): + def get(mail_host, default=None): """Return the named domain. - :param email_host: The email host name of the domain to remove. - :type email_host: string + :param mail_host: The email host name of the domain to remove. + :type mail_host: string :param default: What to return if the named domain does not exist. :type default: object :return: The domain object or None if the named domain does not exist. @@ -134,11 +134,11 @@ class IDomainManager(Interface): :return: iterator over `IDomain`. """ - def __contains__(email_host): + def __contains__(mail_host): """Is this a known domain? - :param email_host: An email host name. - :type email_host: string + :param mail_host: An email host name. + :type mail_host: string :return: True if this domain is known. :rtype: bool """ diff --git a/src/mailman/model/docs/domains.txt b/src/mailman/model/docs/domains.rst index 9fe43a5f1..4fa39aa2f 100644 --- a/src/mailman/model/docs/domains.txt +++ b/src/mailman/model/docs/domains.rst @@ -18,7 +18,7 @@ Domains are how Mailman interacts with email host names and web host names. ... if len(manager) == 0: ... print 'no domains' ... return - ... for domain in sorted(manager, key=attrgetter('email_host')): + ... for domain in sorted(manager, key=attrgetter('mail_host')): ... print domain >>> show_domains() @@ -74,8 +74,8 @@ Domains can have explicit descriptions and contact addresses. In the global domain manager, domains are indexed by their email host name. :: - >>> for domain in sorted(manager, key=attrgetter('email_host')): - ... print domain.email_host + >>> for domain in sorted(manager, key=attrgetter('mail_host')): + ... print domain.mail_host example.com example.net diff --git a/src/mailman/model/docs/requests.txt b/src/mailman/model/docs/requests.rst index 812d25a43..e01544490 100644 --- a/src/mailman/model/docs/requests.txt +++ b/src/mailman/model/docs/requests.rst @@ -312,7 +312,7 @@ indicates that the message has been approved. >>> id_3 = moderator.hold_message(mlist, msg, msgdata, 'Needs approval') >>> moderator.handle_message(mlist, id_3, Action.accept) - >>> inq = config.switchboards['in'] + >>> inq = config.switchboards['pipeline'] >>> qmsg, qdata = dequeue(inq) >>> print qmsg.as_string() From: aperson@example.org diff --git a/src/mailman/model/domain.py b/src/mailman/model/domain.py index 083246469..ad3e84fc7 100644 --- a/src/mailman/model/domain.py +++ b/src/mailman/model/domain.py @@ -43,37 +43,37 @@ class Domain(Model): id = Int(primary=True) - email_host = Unicode() + mail_host = Unicode() base_url = Unicode() description = Unicode() contact_address = Unicode() - def __init__(self, email_host, + def __init__(self, mail_host, description=None, base_url=None, contact_address=None): """Create and register a domain. - :param email_host: The host name for the email interface. - :type email_host: string + :param mail_host: The host name for the email interface. + :type mail_host: string :param description: An optional description of the domain. :type description: string :param base_url: The optional base url for the domain, including scheme. If not given, it will be constructed from the - `email_host` using the http protocol. + `mail_host` using the http protocol. :type base_url: string :param contact_address: The email address to contact a human for this - domain. If not given, postmaster@`email_host` will be used. + domain. If not given, postmaster@`mail_host` will be used. :type contact_address: string """ - self.email_host = email_host + self.mail_host = mail_host self.base_url = (base_url if base_url is not None - else 'http://' + email_host) + else 'http://' + mail_host) self.description = description self.contact_address = (contact_address if contact_address is not None - else 'postmaster@' + email_host) + else 'postmaster@' + mail_host) @property def url_host(self): @@ -92,10 +92,10 @@ class Domain(Model): def __repr__(self): """repr(a_domain)""" if self.description is None: - return ('<Domain {0.email_host}, base_url: {0.base_url}, ' + return ('<Domain {0.mail_host}, base_url: {0.base_url}, ' 'contact_address: {0.contact_address}>').format(self) else: - return ('<Domain {0.email_host}, {0.description}, ' + return ('<Domain {0.mail_host}, {0.description}, ' 'base_url: {0.base_url}, ' 'contact_address: {0.contact_address}>').format(self) @@ -106,40 +106,40 @@ class DomainManager: implements(IDomainManager) - def add(self, email_host, + def add(self, mail_host, description=None, base_url=None, contact_address=None): """See `IDomainManager`.""" - # Be sure the email_host is not already registered. This is probably + # Be sure the mail_host is not already registered. This is probably # a constraint that should (also) be maintained in the database. - if self.get(email_host) is not None: + if self.get(mail_host) is not None: raise BadDomainSpecificationError( - 'Duplicate email host: %s' % email_host) - domain = Domain(email_host, description, base_url, contact_address) + 'Duplicate email host: %s' % mail_host) + domain = Domain(mail_host, description, base_url, contact_address) config.db.store.add(domain) return domain - def remove(self, email_host): - domain = self[email_host] + def remove(self, mail_host): + domain = self[mail_host] config.db.store.remove(domain) return domain - def get(self, email_host, default=None): + def get(self, mail_host, default=None): """See `IDomainManager`.""" - domains = config.db.store.find(Domain, email_host=email_host) + domains = config.db.store.find(Domain, mail_host=mail_host) if domains.count() < 1: return default assert domains.count() == 1, ( - 'Too many matching domains: %s' % email_host) + 'Too many matching domains: %s' % mail_host) return domains.one() - def __getitem__(self, email_host): + def __getitem__(self, mail_host): """See `IDomainManager`.""" missing = object() - domain = self.get(email_host, missing) + domain = self.get(mail_host, missing) if domain is missing: - raise KeyError(email_host) + raise KeyError(mail_host) return domain def __len__(self): @@ -150,6 +150,6 @@ class DomainManager: for domain in config.db.store.find(Domain): yield domain - def __contains__(self, email_host): + def __contains__(self, mail_host): """See `IDomainManager`.""" - return config.db.store.find(Domain, email_host=email_host).count() > 0 + return config.db.store.find(Domain, mail_host=mail_host).count() > 0 diff --git a/src/mailman/rest/docs/domains.txt b/src/mailman/rest/docs/domains.rst index 35546a56d..15638c38d 100644 --- a/src/mailman/rest/docs/domains.txt +++ b/src/mailman/rest/docs/domains.rst @@ -38,8 +38,8 @@ Once a domain is added, it is accessible through the API. base_url: http://lists.example.com contact_address: postmaster@example.com description: An example domain - email_host: example.com http_etag: "..." + mail_host: example.com self_link: http://localhost:9001/3.0/domains/example.com url_host: lists.example.com http_etag: "..." @@ -70,24 +70,24 @@ At the top level, all domains are returned as separate entries. base_url: http://lists.example.com contact_address: postmaster@example.com description: An example domain - email_host: example.com http_etag: "..." + mail_host: example.com self_link: http://localhost:9001/3.0/domains/example.com url_host: lists.example.com entry 1: base_url: http://mail.example.org contact_address: listmaster@example.org description: None - email_host: example.org http_etag: "..." + mail_host: example.org self_link: http://localhost:9001/3.0/domains/example.org url_host: mail.example.org entry 2: base_url: http://example.net contact_address: porkmaster@example.net description: Porkmasters - email_host: lists.example.net http_etag: "..." + mail_host: lists.example.net self_link: http://localhost:9001/3.0/domains/lists.example.net url_host: example.net http_etag: "..." @@ -105,8 +105,8 @@ The information for a single domain is available by following one of the base_url: http://example.net contact_address: porkmaster@example.net description: Porkmasters - email_host: lists.example.net http_etag: "..." + mail_host: lists.example.net self_link: http://localhost:9001/3.0/domains/lists.example.net url_host: example.net @@ -124,7 +124,7 @@ Creating new domains New domains can be created by posting to the ``domains`` url. >>> dump_json('http://localhost:9001/3.0/domains', { - ... 'email_host': 'lists.example.com', + ... 'mail_host': 'lists.example.com', ... }) content-length: 0 date: ... @@ -137,8 +137,8 @@ Now the web service knows about our new domain. base_url: http://lists.example.com contact_address: postmaster@lists.example.com description: None - email_host: lists.example.com http_etag: "..." + mail_host: lists.example.com self_link: http://localhost:9001/3.0/domains/lists.example.com url_host: lists.example.com @@ -158,7 +158,7 @@ address. :: >>> dump_json('http://localhost:9001/3.0/domains', { - ... 'email_host': 'my.example.com', + ... 'mail_host': 'my.example.com', ... 'description': 'My new domain', ... 'base_url': 'http://allmy.example.com', ... 'contact_address': 'helpme@example.com' @@ -172,8 +172,8 @@ address. base_url: http://allmy.example.com contact_address: helpme@example.com description: My new domain - email_host: my.example.com http_etag: "..." + mail_host: my.example.com self_link: http://localhost:9001/3.0/domains/my.example.com url_host: allmy.example.com diff --git a/src/mailman/rest/domains.py b/src/mailman/rest/domains.py index 780380270..d42497157 100644 --- a/src/mailman/rest/domains.py +++ b/src/mailman/rest/domains.py @@ -45,8 +45,8 @@ class _DomainBase(resource.Resource, CollectionMixin): base_url=domain.base_url, contact_address=domain.contact_address, description=domain.description, - email_host=domain.email_host, - self_link=path_to('domains/{0}'.format(domain.email_host)), + mail_host=domain.mail_host, + self_link=path_to('domains/{0}'.format(domain.mail_host)), url_host=domain.url_host, ) @@ -88,7 +88,7 @@ class AllDomains(_DomainBase): """Create a new domain.""" domain_manager = getUtility(IDomainManager) try: - validator = Validator(email_host=unicode, + validator = Validator(mail_host=unicode, description=unicode, base_url=unicode, contact_address=unicode, @@ -99,7 +99,7 @@ class AllDomains(_DomainBase): return http.bad_request([], b'Domain exists') except ValueError as error: return http.bad_request([], str(error)) - location = path_to('domains/{0}'.format(domain.email_host)) + location = path_to('domains/{0}'.format(domain.mail_host)) # Include no extra headers or body. return http.created(location, [], None) |
