summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/domain.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-07-20 23:13:59 -0400
committerBarry Warsaw2009-07-20 23:13:59 -0400
commitbf1204e9c920588adf649033d5db02bb7d75d640 (patch)
treeeced2471a91d7ebc7e5ac56ee204c64b8f0fe564 /src/mailman/interfaces/domain.py
parentd9ad19e86ff658a74870fb488cd74e5002b63bc3 (diff)
downloadmailman-bf1204e9c920588adf649033d5db02bb7d75d640.tar.gz
mailman-bf1204e9c920588adf649033d5db02bb7d75d640.tar.zst
mailman-bf1204e9c920588adf649033d5db02bb7d75d640.zip
Our first writable REST API! You can now create new domains through the
webserver. Fix the https/http urls. Add the adapter for HTTPCharsets so POSTs work properly. Nice little cargo cult from lazr.restful.
Diffstat (limited to 'src/mailman/interfaces/domain.py')
-rw-r--r--src/mailman/interfaces/domain.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py
index f9476fc3d..96ec1568d 100644
--- a/src/mailman/interfaces/domain.py
+++ b/src/mailman/interfaces/domain.py
@@ -29,7 +29,7 @@ __all__ = [
from lazr.restful.declarations import (
collection_default_content, export_as_webservice_collection,
- export_as_webservice_entry, exported)
+ export_as_webservice_entry, export_factory_operation, exported)
from zope.interface import Interface, Attribute
from zope.schema import TextLine
@@ -174,3 +174,27 @@ class IDomainCollection(Interface):
:return: The list of all known domains.
:rtype: list of `IDomain`
"""
+
+ @export_factory_operation(
+ IDomain,
+ ('email_host', 'description', 'base_url', 'contact_address'))
+ def new(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.
+ """