launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29688
[Merge] ~cjwatson/launchpad:zcml-namespaces-mail into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:zcml-namespaces-mail into launchpad:master.
Commit message:
Move ZCML mail-related directives to lp namespace
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/437576
As with commit 57196c1d6a220f00039e027768cc05368135f556, it makes sense to move our various local `*MailBox` and `*Mailer` directives to our own namespace rather than poking them into the Zope mail namespace.
We retain some backward-compatibility registrations with the old namespace for the time being, as these directives appear in some per-environment configuration files.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:zcml-namespaces-mail into launchpad:master.
diff --git a/configs/development/directory-testing-mailbox.zcml.example b/configs/development/directory-testing-mailbox.zcml.example
index 64301cc..2af8d69 100644
--- a/configs/development/directory-testing-mailbox.zcml.example
+++ b/configs/development/directory-testing-mailbox.zcml.example
@@ -1,8 +1,8 @@
<configure
xmlns="http://namespaces.zope.org/zope"
- xmlns:mail="http://namespaces.zope.org/mail">
+ xmlns:lp="http://namespaces.canonical.com/lp">
- <mail:directoryMailBox
+ <lp:directoryMailBox
directory="/var/tmp/launchpad_script_mailbox" />
-</configure>
\ No newline at end of file
+</configure>
diff --git a/doc/reference/email.rst b/doc/reference/email.rst
index 12d19f7..21fa9cf 100644
--- a/doc/reference/email.rst
+++ b/doc/reference/email.rst
@@ -22,6 +22,7 @@ similar to the following::
<configure
xmlns="http://namespaces.zope.org/zope"
+ xmlns:lp="http://namespaces.canonical.com/lp"
xmlns:mail="http://namespaces.zope.org/mail"
i18n_domain="zope">
@@ -35,7 +36,7 @@ similar to the following::
password="pass"
/>
- <mail:stubMailer
+ <lp:stubMailer
name="stub"
from_addr="stuart@xxxxxxxxxxxxxxxx"
to_addr="stuart@xxxxxxxxxxxxxxxx"
@@ -43,9 +44,9 @@ similar to the following::
rewrite="false"
/>
- <mail:testMailer name="test-mailer" />
+ <lp:testMailer name="test-mailer" />
- <mail:mboxMailer
+ <lp:mboxMailer
name="mbox"
filename="/tmp/launchpad.mbox"
overwrite="true"
@@ -86,25 +87,25 @@ most people won't actually need the `mail:smtpMailer` tag because the defaults
will usually just work. However, several additional mailers are available for
you to use, depending on what you're trying to do.
-The `mail:stubMailer` can be used to forward all emails to your normal inbox
+The `lp:stubMailer` can be used to forward all emails to your normal inbox
via some other mailer. Think of it as a proxy mailer that can be used to
specify explicit MAIL FROM and RCTP TO envelope addresses. The `rewrite`
-attribute of the `mail:stubMailer` specifies whether the RFC 2822 headers
+attribute of the `lp:stubMailer` specifies whether the RFC 2822 headers
should also be rewritten. You and your spam filters might prefer this set to
`true`.
-The `mail:mboxMailer` stores messages in a Unix mbox file and then forwards
+The `lp:mboxMailer` stores messages in a Unix mbox file and then forwards
the message on to another mailer. You can use this if you want a record on
disk of all the messages sent, or if you'd rather not clutter up your inbox
with all your Launchpad test email. The `overwrite` attribute says whether to
truncate the mbox file when Launchpad starts up (i.e. opens the file once in
'w' mode before appending all new messages to the file).
-The `mail:testMailer` is necessary for the Launchpad tests to work. You must
+The `lp:testMailer` is necessary for the Launchpad tests to work. You must
use a `mail:directDelivery` mailer for the tests, otherwise you'll get lots of
failures. Basically, the testMailer stores the messages in a list in memory.
-For both `mail:mboxMailer` and `mail:stubMailer` the `mailer` attribute
+For both `mail:mboxMailer` and `lp:stubMailer` the `mailer` attribute
specifies the next mailer in the chain that the message will get sent to.
Thus if `mailer` is set to `smtp`, you'll get the messages in your inbox, but
if it's `test-mailer`, the unit tests will work.
@@ -112,14 +113,14 @@ if it's `test-mailer`, the unit tests will work.
Finally, these are all hooked up at the top with either a
`mail:queuedDelivery` section or a `mail:directDelivery` tag. You must
use a `mail:directDelivery` tag if you want the unit tests to work because
-otherwise, the in-memory list of the `mail:testMailer` won't be updated by the
+otherwise, the in-memory list of the `lp:testMailer` won't be updated by the
time the unit test checks it.
If you just want the unit tests to work normally, don't include a
`mail:queuedDelivery` or a `mail:directDelivery` section at all. Launchpad
will DTRT internally. However, if you want copies in an mbox file or in your
inbox, set the `mailer` attribute to the appropriate mailer, chaining that to
-a `mail:testMailer` for the unit tests or a `mail:smtpMailer` for
+an `lp:testMailer` for the unit tests or a `mail:smtpMailer` for
development.
diff --git a/lib/lp/services/mail/doc/mailbox.rst b/lib/lp/services/mail/doc/mailbox.rst
index 454b10f..e9f9ec0 100644
--- a/lib/lp/services/mail/doc/mailbox.rst
+++ b/lib/lp/services/mail/doc/mailbox.rst
@@ -7,11 +7,11 @@ box.
There's also an IMailBox which interfaces with a POP3 server. It can be
configured in ZCML with:
- <mail:pop3MailBox host="somehost" user="someuser" password="secret" />
+ <lp:pop3MailBox host="somehost" user="someuser" password="secret" />
It also supports POP3 over ssl:
- <mail:pop3MailBox
+ <lp:pop3MailBox
host="somehost" user="someuser" password="secret" ssl="true" />
The third is the DirectoryMailBox and can be configured to operate for
diff --git a/lib/lp/services/mail/meta.zcml b/lib/lp/services/mail/meta.zcml
index 64d18f8..2593232 100644
--- a/lib/lp/services/mail/meta.zcml
+++ b/lib/lp/services/mail/meta.zcml
@@ -7,41 +7,71 @@
xmlns:meta="http://namespaces.zope.org/meta">
<meta:directive
- namespace="http://namespaces.zope.org/mail"
+ namespace="http://namespaces.canonical.com/lp"
name="testMailBox"
schema=".meta.ITestMailBoxDirective"
handler=".meta.testMailBoxHandler"
/>
<meta:directive
- namespace="http://namespaces.zope.org/mail"
+ namespace="http://namespaces.canonical.com/lp"
name="pop3MailBox"
schema=".meta.IPOP3MailBoxDirective"
handler=".meta.pop3MailBoxHandler"
/>
<meta:directive
- namespace="http://namespaces.zope.org/mail"
+ namespace="http://namespaces.canonical.com/lp"
name="directoryMailBox"
schema=".meta.IDirectoryMailBoxDirective"
handler=".meta.directorymailBoxHandler"
/>
<meta:directive
- namespace="http://namespaces.zope.org/mail"
+ namespace="http://namespaces.canonical.com/lp"
name="stubMailer"
schema=".meta.IStubMailerDirective"
handler=".meta.stubMailerHandler"
/>
<meta:directive
- namespace="http://namespaces.zope.org/mail"
+ namespace="http://namespaces.canonical.com/lp"
name="testMailer"
schema=".meta.ITestMailerDirective"
handler=".meta.testMailerHandler"
/>
<meta:directive
+ namespace="http://namespaces.canonical.com/lp"
+ name="mboxMailer"
+ schema=".meta.IMboxMailerDirective"
+ handler=".meta.mboxMailerHandler"
+ />
+
+ <!-- Backward-compatibility with existing configurations. -->
+
+ <meta:directive
+ namespace="http://namespaces.zope.org/mail"
+ name="pop3MailBox"
+ schema=".meta.IPOP3MailBoxDirective"
+ handler=".meta.pop3MailBoxHandler"
+ />
+
+ <meta:directive
+ namespace="http://namespaces.zope.org/mail"
+ name="directoryMailBox"
+ schema=".meta.IDirectoryMailBoxDirective"
+ handler=".meta.directorymailBoxHandler"
+ />
+
+ <meta:directive
+ namespace="http://namespaces.zope.org/mail"
+ name="stubMailer"
+ schema=".meta.IStubMailerDirective"
+ handler=".meta.stubMailerHandler"
+ />
+
+ <meta:directive
namespace="http://namespaces.zope.org/mail"
name="mboxMailer"
schema=".meta.IMboxMailerDirective"
diff --git a/zcml/package-includes/mail-configure-normal.zcml b/zcml/package-includes/mail-configure-normal.zcml
index 8211f06..c5313a0 100644
--- a/zcml/package-includes/mail-configure-normal.zcml
+++ b/zcml/package-includes/mail-configure-normal.zcml
@@ -4,12 +4,13 @@
<configure
xmlns="http://namespaces.zope.org/zope"
+ xmlns:lp="http://namespaces.canonical.com/lp"
xmlns:mail="http://namespaces.zope.org/mail"
i18n_domain="zope">
<include package="zope.sendmail"/>
- <mail:stubMailer
+ <lp:stubMailer
name="stub" from_addr="root@localhost" to_addr="root@localhost"
/>
diff --git a/zcml/package-includes/mail-configure-testing.zcml b/zcml/package-includes/mail-configure-testing.zcml
index ff46164..d075d86 100644
--- a/zcml/package-includes/mail-configure-testing.zcml
+++ b/zcml/package-includes/mail-configure-testing.zcml
@@ -4,6 +4,7 @@
<configure
xmlns="http://namespaces.zope.org/zope"
+ xmlns:lp="http://namespaces.canonical.com/lp"
xmlns:mail="http://namespaces.zope.org/mail"
i18n_domain="zope">
@@ -12,11 +13,11 @@
<!-- Configure email for testing. Use direct delivery instead of
queued, as otherwise tests would be more painful and the background
thread created by queuedDelivery causes trouble too -->
- <mail:testMailer name="test" />
+ <lp:testMailer name="test" />
<mail:directDelivery name="Mail" permission="zope.SendMail" mailer="test" />
<!-- Configure a mail box which can be used when testing. Every email that
you send using testMailer will appear in this mail box. -->
- <mail:testMailBox />
+ <lp:testMailBox />
</configure>