From 853060fa5fd453b745b09d991b8053c2024cb079 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 29 Jun 2009 21:30:04 -0400 Subject: More REST server updates. * Get rid of in-Python adapter registration in favor of ZCML. Eventually, I'd like to get rid of the ZCML. * Set the view_permission to None, but it's still not right. * Add IDomainSet and an adapter from Configuration to IDomainSet. --- src/mailman/interfaces/domain.py | 70 ++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 27 deletions(-) (limited to 'src/mailman/interfaces/domain.py') diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py index 773290bc5..0692d21d5 100644 --- a/src/mailman/interfaces/domain.py +++ b/src/mailman/interfaces/domain.py @@ -22,49 +22,54 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ 'IDomain', + 'IDomainSet', ] +from lazr.restful.declarations import ( + collection_default_content, export_as_webservice_collection, + export_as_webservice_entry, exported) from zope.interface import Interface, Attribute +from zope.schema import TextLine + +from mailman.i18n import _ class IDomain(Interface): """Interface representing domains.""" - email_host = Attribute( - """The host name for email for this domain. - - :type: string - """) - - url_host = Attribute( - """The host name for the web interface for this domain. - - :type: string - """) - - base_url = Attribute( - """The base url for the Mailman server at this domain. - - The base url includes the scheme and host name. + export_as_webservice_entry() - :type: string - """) + email_host = exported(TextLine( + title=_('Email host name'), + description=_('The host name for email for this domain.'), + )) - description = Attribute( - """The human readable description of the domain name. + url_host = exported(TextLine( + title=_('Web host name'), + description=_('The host name for the web interface for this domain.') + )) - :type: string - """) + base_url = exported(TextLine( + title=_('Base URL'), + description=_("""\ + The base url for the Mailman server at this domain, which includes the + scheme and host name."""), + )) - contact_address = Attribute( - """The contact address for the human at this domain. + description = exported(TextLine( + title=_('Description'), + description=_('The human readable description of the domain name.'), + )) - E.g. postmaster@example.com + contact_address = exported(TextLine( + title=_('Contact address'), + description=_("""\ + The contact address for the human at this domain. - :type: string - """) + E.g. postmaster@example.com"""), + )) def confirm_address(token=''): """The address used for various forms of email confirmation. @@ -83,3 +88,14 @@ class IDomain(Interface): :return: The confirmation url. :rtype: string """ + + + +class IDomainSet(Interface): + """The set of all known domains.""" + + export_as_webservice_collection(IDomain) + + @collection_default_content() + def __iter__(): + """Iterate over all domains.""" -- cgit v1.2.3-70-g09d2