diff options
| author | Barry Warsaw | 2008-09-23 22:38:19 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-09-23 22:38:19 -0400 |
| commit | d29eade5e68125c506950f260c8e685db75f653c (patch) | |
| tree | 26dd368596b30883a5e9027b5584ac35b0d53878 | |
| parent | a2234211b97797aebf2c3c3d615ae436bbfb280b (diff) | |
| parent | 05ee0005885c98adf676858bcba65527f6d29051 (diff) | |
| download | mailman-d29eade5e68125c506950f260c8e685db75f653c.tar.gz mailman-d29eade5e68125c506950f260c8e685db75f653c.tar.zst mailman-d29eade5e68125c506950f260c8e685db75f653c.zip | |
| -rw-r--r-- | TODO.txt | 1 | ||||
| -rw-r--r-- | mailman/app/registrar.py | 21 | ||||
| -rw-r--r-- | mailman/archiving/pipermail.py | 6 | ||||
| -rw-r--r-- | mailman/docs/domains.txt | 5 | ||||
| -rw-r--r-- | mailman/docs/registration.txt | 36 |
5 files changed, 39 insertions, 30 deletions
@@ -8,7 +8,6 @@ Add tests for plugins Rework MTA plugins and add tests Address XXX and FIXME Fix the roster creation cruft for mailing lists -Suss out the IDomain stuff Remove Date: header from messagestore requirements (see list thread) Handle moderation flag (see Mailman.app.membership) Eradicate MailList.Lock() and friends. diff --git a/mailman/app/registrar.py b/mailman/app/registrar.py index 64bf8dc79..60fbd5f07 100644 --- a/mailman/app/registrar.py +++ b/mailman/app/registrar.py @@ -27,6 +27,7 @@ import datetime import pkg_resources from zope.interface import implements +from zope.interface.interface import adapter_hooks from mailman.Message import UserNotification from mailman.Utils import ValidateEmail @@ -74,7 +75,7 @@ class Registrar: token = config.db.pendings.add(pendable) # Set up some local variables for translation interpolation. domain = IDomain(self._context) - domain_name = _(domain.domain_name) + domain_name = _(domain.email_host) contact_address = domain.contact_address confirm_url = domain.confirm_url(token) confirm_address = domain.confirm_address(token) @@ -142,3 +143,21 @@ class Registrar: def discard(self, token): # Throw the record away. config.db.pendings.confirm(token) + + + +def adapt_domain_to_registrar(iface, obj): + """Adapt `IDomain` to `IRegistrar`. + + :param iface: The interface to adapt to. + :type iface: `zope.interface.Interface` + :param obj: The object being adapted. + :type obj: `IDomain` + :return: An `IRegistrar` instance if adaptation succeeded or None if it + didn't. + """ + return (Registrar(obj) + if IDomain.providedBy(obj) and iface is IRegistrar + else None) + +adapter_hooks.append(adapt_domain_to_registrar) diff --git a/mailman/archiving/pipermail.py b/mailman/archiving/pipermail.py index 5c5fb17ea..b9380b5e1 100644 --- a/mailman/archiving/pipermail.py +++ b/mailman/archiving/pipermail.py @@ -68,9 +68,9 @@ def adapt_mailing_list_for_pipermail(iface, obj): :return: An `IPipermailMailingList` instance if adaptation succeeded or None if it didn't. """ - if IMailingList.providedBy(obj) and iface is IPipermailMailingList: - return PipermailMailingListAdapter(obj) - return None + return (PipermailMailingListAdapter(obj) + if IMailingList.providedBy(obj) and iface is IPipermailMailingList + else None) adapter_hooks.append(adapt_mailing_list_for_pipermail) diff --git a/mailman/docs/domains.txt b/mailman/docs/domains.txt index 6ae53931c..d29e6ef9f 100644 --- a/mailman/docs/domains.txt +++ b/mailman/docs/domains.txt @@ -12,7 +12,12 @@ At a minimum, the email host name must be specified. The domain object can be looked up by email host name. + >>> from zope.interface.verify import verifyObject + >>> from mailman.interfaces.domain import IDomain >>> domain = config.domains['example.net'] + >>> verifyObject(IDomain, domain) + True + >>> print domain.email_host example.net diff --git a/mailman/docs/registration.txt b/mailman/docs/registration.txt index abc5c9857..2e3ef23e5 100644 --- a/mailman/docs/registration.txt +++ b/mailman/docs/registration.txt @@ -16,27 +16,11 @@ Specifically, it does not handle verifications, email address syntax validity checks, etc. The IRegistrar is the interface to the object handling all this stuff. -Create a dummy domain, which will provide the context for the verification -email message. +Add a domain, which will provide the context for the verification email +message. - >>> from zope.interface import implements - >>> from mailman.interfaces import IDomain - >>> class TestDomain(object): - ... implements(IDomain) - ... def __init__(self): - ... self.domain_name = 'example.com' - ... self.description = 'mail.example.com' - ... self.contact_address = 'postmaster@mail.example.com' - ... self.base_url = 'http://mail.example.com' - ... def confirm_address(self, token=''): - ... return 'confirm+%s@example.com' % token - ... def confirm_url(self, token=''): - ... return self.base_url + '/confirm/' + token - ... def __conform__(self, protocol): - ... if protocol is IRegistrar: - ... return Registrar(self) - ... return None - >>> domain = TestDomain() + >>> config.add_domain('mail.example.com', 'http://mail.example.com') + >>> domain = config.domains['mail.example.com'] Get a registrar by adapting a context to the interface. @@ -143,7 +127,7 @@ message is sent to the user in order to verify the registered address. Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: confirm ... - From: confirm+...@example.com + From: confirm-...@mail.example.com To: aperson@example.com Message-ID: <...> Date: ... @@ -151,7 +135,7 @@ message is sent to the user in order to verify the registered address. <BLANKLINE> Email Address Registration Confirmation <BLANKLINE> - Hello, this is the GNU Mailman server at example.com. + Hello, this is the GNU Mailman server at mail.example.com. <BLANKLINE> We have received a registration request for the email address <BLANKLINE> @@ -165,8 +149,8 @@ message is sent to the user in order to verify the registered address. http://mail.example.com/confirm/... <BLANKLINE> If you do not wish to register this email address simply disregard this - message. If you think you are being maliciously subscribed to the list, or - have any other questions, you may contact + message. If you think you are being maliciously subscribed to the list, + or have any other questions, you may contact <BLANKLINE> postmaster@mail.example.com <BLANKLINE> @@ -188,7 +172,7 @@ appear in a URL in the body of the message. The same token will appear in the From header. - >>> qmsg['from'] == 'confirm+' + token + '@example.com' + >>> qmsg['from'] == 'confirm-' + token + '@mail.example.com' True It will also appear in the Subject header. @@ -344,6 +328,8 @@ that doesn't match a registration even, you will get None. However, the pending even matched with that token will still be removed. >>> from mailman.interfaces import IPendable + >>> from zope.interface import implements + >>> class SimplePendable(dict): ... implements(IPendable) >>> pendable = SimplePendable(type='foo', bar='baz') |
