Merge ~cjwatson/launchpad:zcml-namespaces-mail into launchpad:master

Proposed by Colin Watson
Status: Needs review
Proposed branch: ~cjwatson/launchpad:zcml-namespaces-mail
Merge into: launchpad:master
Diff against target: 242 lines (+56/-23)
6 files modified
configs/development/directory-testing-mailbox.zcml.example (+3/-3)
doc/reference/email.rst (+11/-10)
lib/lp/services/mail/doc/mailbox.rst (+2/-2)
lib/lp/services/mail/meta.zcml (+35/-5)
zcml/package-includes/mail-configure-normal.zcml (+2/-1)
zcml/package-includes/mail-configure-testing.zcml (+3/-2)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+437576@code.launchpad.net

Commit message

Move ZCML mail-related directives to lp namespace

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) wrote :
review: Approve

Unmerged commits

9c0ae68... by Colin Watson

Move ZCML mail-related directives to lp namespace

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.

Succeeded
[SUCCEEDED] docs:0 (build)
[SUCCEEDED] lint:0 (build)
[SUCCEEDED] mypy:0 (build)
13 of 3 results

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/configs/development/directory-testing-mailbox.zcml.example b/configs/development/directory-testing-mailbox.zcml.example
2index 64301cc..2af8d69 100644
3--- a/configs/development/directory-testing-mailbox.zcml.example
4+++ b/configs/development/directory-testing-mailbox.zcml.example
5@@ -1,8 +1,8 @@
6 <configure
7 xmlns="http://namespaces.zope.org/zope"
8- xmlns:mail="http://namespaces.zope.org/mail">
9+ xmlns:lp="http://namespaces.canonical.com/lp">
10
11- <mail:directoryMailBox
12+ <lp:directoryMailBox
13 directory="/var/tmp/launchpad_script_mailbox" />
14
15-</configure>
16\ No newline at end of file
17+</configure>
18diff --git a/doc/reference/email.rst b/doc/reference/email.rst
19index 12d19f7..21fa9cf 100644
20--- a/doc/reference/email.rst
21+++ b/doc/reference/email.rst
22@@ -22,6 +22,7 @@ similar to the following::
23
24 <configure
25 xmlns="http://namespaces.zope.org/zope"
26+ xmlns:lp="http://namespaces.canonical.com/lp"
27 xmlns:mail="http://namespaces.zope.org/mail"
28 i18n_domain="zope">
29
30@@ -35,7 +36,7 @@ similar to the following::
31 password="pass"
32 />
33
34- <mail:stubMailer
35+ <lp:stubMailer
36 name="stub"
37 from_addr="stuart@stuartbishop.net"
38 to_addr="stuart@stuartbishop.net"
39@@ -43,9 +44,9 @@ similar to the following::
40 rewrite="false"
41 />
42
43- <mail:testMailer name="test-mailer" />
44+ <lp:testMailer name="test-mailer" />
45
46- <mail:mboxMailer
47+ <lp:mboxMailer
48 name="mbox"
49 filename="/tmp/launchpad.mbox"
50 overwrite="true"
51@@ -86,25 +87,25 @@ most people won't actually need the `mail:smtpMailer` tag because the defaults
52 will usually just work. However, several additional mailers are available for
53 you to use, depending on what you're trying to do.
54
55-The `mail:stubMailer` can be used to forward all emails to your normal inbox
56+The `lp:stubMailer` can be used to forward all emails to your normal inbox
57 via some other mailer. Think of it as a proxy mailer that can be used to
58 specify explicit MAIL FROM and RCTP TO envelope addresses. The `rewrite`
59-attribute of the `mail:stubMailer` specifies whether the RFC 2822 headers
60+attribute of the `lp:stubMailer` specifies whether the RFC 2822 headers
61 should also be rewritten. You and your spam filters might prefer this set to
62 `true`.
63
64-The `mail:mboxMailer` stores messages in a Unix mbox file and then forwards
65+The `lp:mboxMailer` stores messages in a Unix mbox file and then forwards
66 the message on to another mailer. You can use this if you want a record on
67 disk of all the messages sent, or if you'd rather not clutter up your inbox
68 with all your Launchpad test email. The `overwrite` attribute says whether to
69 truncate the mbox file when Launchpad starts up (i.e. opens the file once in
70 'w' mode before appending all new messages to the file).
71
72-The `mail:testMailer` is necessary for the Launchpad tests to work. You must
73+The `lp:testMailer` is necessary for the Launchpad tests to work. You must
74 use a `mail:directDelivery` mailer for the tests, otherwise you'll get lots of
75 failures. Basically, the testMailer stores the messages in a list in memory.
76
77-For both `mail:mboxMailer` and `mail:stubMailer` the `mailer` attribute
78+For both `mail:mboxMailer` and `lp:stubMailer` the `mailer` attribute
79 specifies the next mailer in the chain that the message will get sent to.
80 Thus if `mailer` is set to `smtp`, you'll get the messages in your inbox, but
81 if it's `test-mailer`, the unit tests will work.
82@@ -112,14 +113,14 @@ if it's `test-mailer`, the unit tests will work.
83 Finally, these are all hooked up at the top with either a
84 `mail:queuedDelivery` section or a `mail:directDelivery` tag. You must
85 use a `mail:directDelivery` tag if you want the unit tests to work because
86-otherwise, the in-memory list of the `mail:testMailer` won't be updated by the
87+otherwise, the in-memory list of the `lp:testMailer` won't be updated by the
88 time the unit test checks it.
89
90 If you just want the unit tests to work normally, don't include a
91 `mail:queuedDelivery` or a `mail:directDelivery` section at all. Launchpad
92 will DTRT internally. However, if you want copies in an mbox file or in your
93 inbox, set the `mailer` attribute to the appropriate mailer, chaining that to
94-a `mail:testMailer` for the unit tests or a `mail:smtpMailer` for
95+an `lp:testMailer` for the unit tests or a `mail:smtpMailer` for
96 development.
97
98
99diff --git a/lib/lp/services/mail/doc/mailbox.rst b/lib/lp/services/mail/doc/mailbox.rst
100index 454b10f..e9f9ec0 100644
101--- a/lib/lp/services/mail/doc/mailbox.rst
102+++ b/lib/lp/services/mail/doc/mailbox.rst
103@@ -7,11 +7,11 @@ box.
104 There's also an IMailBox which interfaces with a POP3 server. It can be
105 configured in ZCML with:
106
107- <mail:pop3MailBox host="somehost" user="someuser" password="secret" />
108+ <lp:pop3MailBox host="somehost" user="someuser" password="secret" />
109
110 It also supports POP3 over ssl:
111
112- <mail:pop3MailBox
113+ <lp:pop3MailBox
114 host="somehost" user="someuser" password="secret" ssl="true" />
115
116 The third is the DirectoryMailBox and can be configured to operate for
117diff --git a/lib/lp/services/mail/meta.zcml b/lib/lp/services/mail/meta.zcml
118index 64d18f8..2593232 100644
119--- a/lib/lp/services/mail/meta.zcml
120+++ b/lib/lp/services/mail/meta.zcml
121@@ -7,41 +7,71 @@
122 xmlns:meta="http://namespaces.zope.org/meta">
123
124 <meta:directive
125- namespace="http://namespaces.zope.org/mail"
126+ namespace="http://namespaces.canonical.com/lp"
127 name="testMailBox"
128 schema=".meta.ITestMailBoxDirective"
129 handler=".meta.testMailBoxHandler"
130 />
131
132 <meta:directive
133- namespace="http://namespaces.zope.org/mail"
134+ namespace="http://namespaces.canonical.com/lp"
135 name="pop3MailBox"
136 schema=".meta.IPOP3MailBoxDirective"
137 handler=".meta.pop3MailBoxHandler"
138 />
139
140 <meta:directive
141- namespace="http://namespaces.zope.org/mail"
142+ namespace="http://namespaces.canonical.com/lp"
143 name="directoryMailBox"
144 schema=".meta.IDirectoryMailBoxDirective"
145 handler=".meta.directorymailBoxHandler"
146 />
147
148 <meta:directive
149- namespace="http://namespaces.zope.org/mail"
150+ namespace="http://namespaces.canonical.com/lp"
151 name="stubMailer"
152 schema=".meta.IStubMailerDirective"
153 handler=".meta.stubMailerHandler"
154 />
155
156 <meta:directive
157- namespace="http://namespaces.zope.org/mail"
158+ namespace="http://namespaces.canonical.com/lp"
159 name="testMailer"
160 schema=".meta.ITestMailerDirective"
161 handler=".meta.testMailerHandler"
162 />
163
164 <meta:directive
165+ namespace="http://namespaces.canonical.com/lp"
166+ name="mboxMailer"
167+ schema=".meta.IMboxMailerDirective"
168+ handler=".meta.mboxMailerHandler"
169+ />
170+
171+ <!-- Backward-compatibility with existing configurations. -->
172+
173+ <meta:directive
174+ namespace="http://namespaces.zope.org/mail"
175+ name="pop3MailBox"
176+ schema=".meta.IPOP3MailBoxDirective"
177+ handler=".meta.pop3MailBoxHandler"
178+ />
179+
180+ <meta:directive
181+ namespace="http://namespaces.zope.org/mail"
182+ name="directoryMailBox"
183+ schema=".meta.IDirectoryMailBoxDirective"
184+ handler=".meta.directorymailBoxHandler"
185+ />
186+
187+ <meta:directive
188+ namespace="http://namespaces.zope.org/mail"
189+ name="stubMailer"
190+ schema=".meta.IStubMailerDirective"
191+ handler=".meta.stubMailerHandler"
192+ />
193+
194+ <meta:directive
195 namespace="http://namespaces.zope.org/mail"
196 name="mboxMailer"
197 schema=".meta.IMboxMailerDirective"
198diff --git a/zcml/package-includes/mail-configure-normal.zcml b/zcml/package-includes/mail-configure-normal.zcml
199index 8211f06..c5313a0 100644
200--- a/zcml/package-includes/mail-configure-normal.zcml
201+++ b/zcml/package-includes/mail-configure-normal.zcml
202@@ -4,12 +4,13 @@
203
204 <configure
205 xmlns="http://namespaces.zope.org/zope"
206+ xmlns:lp="http://namespaces.canonical.com/lp"
207 xmlns:mail="http://namespaces.zope.org/mail"
208 i18n_domain="zope">
209
210 <include package="zope.sendmail"/>
211
212- <mail:stubMailer
213+ <lp:stubMailer
214 name="stub" from_addr="root@localhost" to_addr="root@localhost"
215 />
216
217diff --git a/zcml/package-includes/mail-configure-testing.zcml b/zcml/package-includes/mail-configure-testing.zcml
218index ff46164..d075d86 100644
219--- a/zcml/package-includes/mail-configure-testing.zcml
220+++ b/zcml/package-includes/mail-configure-testing.zcml
221@@ -4,6 +4,7 @@
222
223 <configure
224 xmlns="http://namespaces.zope.org/zope"
225+ xmlns:lp="http://namespaces.canonical.com/lp"
226 xmlns:mail="http://namespaces.zope.org/mail"
227 i18n_domain="zope">
228
229@@ -12,11 +13,11 @@
230 <!-- Configure email for testing. Use direct delivery instead of
231 queued, as otherwise tests would be more painful and the background
232 thread created by queuedDelivery causes trouble too -->
233- <mail:testMailer name="test" />
234+ <lp:testMailer name="test" />
235 <mail:directDelivery name="Mail" permission="zope.SendMail" mailer="test" />
236
237 <!-- Configure a mail box which can be used when testing. Every email that
238 you send using testMailer will appear in this mail box. -->
239- <mail:testMailBox />
240+ <lp:testMailBox />
241
242 </configure>

Subscribers

People subscribed via source and target branches

to status/vote changes: