summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/domain.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/interfaces/domain.py')
-rw-r--r--src/mailman/interfaces/domain.py77
1 files changed, 74 insertions, 3 deletions
diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py
index 1546f9487..f9476fc3d 100644
--- a/src/mailman/interfaces/domain.py
+++ b/src/mailman/interfaces/domain.py
@@ -22,7 +22,8 @@ from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
'IDomain',
- 'IDomainSet',
+ 'IDomainCollection',
+ 'IDomainManager',
]
@@ -91,8 +92,78 @@ class IDomain(Interface):
-class IDomainSet(Interface):
- """The set of all known domains."""
+class IDomainManager(Interface):
+ """The manager of domains."""
+
+ def add(email_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 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`/
+ :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`
+ :type contact_address: string
+ :return: The new domain object
+ :rtype: `IDomain`
+ :raises `BadDomainSpecificationError`: when the `email_host` is
+ already registered.
+ """
+
+ def remove(email_host):
+ """Remove the domain.
+
+ :param email_host: The email host name of the domain to remove.
+ :type email_host: string
+ :raises KeyError: if the named domain does not exist.
+ """
+
+ def __getitem__(email_host):
+ """Return the named domain.
+
+ :param email_host: The email host name of the domain to remove.
+ :type email_host: string
+ :return: The domain object.
+ :rtype: `IDomain`
+ :raises KeyError: if the named domain does not exist.
+ """
+
+ def get(email_host, default=None):
+ """Return the named domain.
+
+ :param email_host: The email host name of the domain to remove.
+ :type email_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.
+ :rtype: `IDomain`
+ """
+
+ def __iter__():
+ """An iterator over all the domains.
+
+ :return: iterator over `IDomain`.
+ """
+
+ def __contains__(email_host):
+ """Is this a known domain?
+
+ :param email_host: An email host name.
+ :type email_host: string
+ :return: True if this domain is known.
+ :rtype: bool
+ """
+
+
+
+class IDomainCollection(Interface):
+ """The set of domains available via the REST API."""
export_as_webservice_collection(IDomain)