Merge lp:~adeuring/launchpad/bug-588276 into lp:launchpad
- bug-588276
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11018 |
Proposed branch: | lp:~adeuring/launchpad/bug-588276 |
Merge into: | lp:launchpad |
Diff against target: |
524 lines (+343/-11) 9 files modified
lib/lp/bugs/browser/bugtarget.py (+45/-1) lib/lp/bugs/browser/tests/test_bugtarget_configure.py (+5/-1) lib/lp/bugs/browser/tests/test_bugtarget_filebug.py (+264/-0) lib/lp/bugs/stories/guided-filebug/xx-bug-reporting-guidelines.txt (+18/-2) lib/lp/registry/browser/distribution.py (+2/-1) lib/lp/registry/browser/distributionsourcepackage.py (+1/-0) lib/lp/registry/browser/project.py (+3/-2) lib/lp/registry/browser/tests/distribution-views.txt (+4/-3) lib/lp/registry/browser/tests/distributionsourcepackage-views.txt (+1/-1) |
To merge this branch: | bzr merge lp:~adeuring/launchpad/bug-588276 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+27606@code.launchpad.net |
Commit message
Description of the change
This branch fixes bug 588276: "Enable use of bug_reported_
It adds the field bug_reported_
The property bug_reported_
This acquisition logic is fine, but it ignores the case that a customized message is defined for a project group but not for a project within the project group, or for a distribution but not for DistributionSou
Hence I duplicated/
tests:
bin/test -t test_bugtarget_
bin/test -t xx-bug-
no lint
Preview Diff
1 | === modified file 'lib/lp/bugs/browser/bugtarget.py' | |||
2 | --- lib/lp/bugs/browser/bugtarget.py 2010-06-08 10:36:00 +0000 | |||
3 | +++ lib/lp/bugs/browser/bugtarget.py 2010-06-16 08:24:32 +0000 | |||
4 | @@ -120,6 +120,8 @@ | |||
5 | 120 | remote_product = copy_field(IProduct['remote_product']) | 120 | remote_product = copy_field(IProduct['remote_product']) |
6 | 121 | bug_reporting_guidelines = copy_field( | 121 | bug_reporting_guidelines = copy_field( |
7 | 122 | IBugTarget['bug_reporting_guidelines']) | 122 | IBugTarget['bug_reporting_guidelines']) |
8 | 123 | bug_reported_acknowledgement = copy_field( | ||
9 | 124 | IBugTarget['bug_reported_acknowledgement']) | ||
10 | 123 | 125 | ||
11 | 124 | 126 | ||
12 | 125 | def product_to_productbugconfiguration(product): | 127 | def product_to_productbugconfiguration(product): |
13 | @@ -141,6 +143,7 @@ | |||
14 | 141 | "enable_bug_expiration", | 143 | "enable_bug_expiration", |
15 | 142 | "remote_product", | 144 | "remote_product", |
16 | 143 | "bug_reporting_guidelines", | 145 | "bug_reporting_guidelines", |
17 | 146 | "bug_reported_acknowledgement", | ||
18 | 144 | ] | 147 | ] |
19 | 145 | custom_widget('bugtracker', ProductBugTrackerWidget) | 148 | custom_widget('bugtracker', ProductBugTrackerWidget) |
20 | 146 | 149 | ||
21 | @@ -443,7 +446,7 @@ | |||
22 | 443 | else: | 446 | else: |
23 | 444 | private = False | 447 | private = False |
24 | 445 | 448 | ||
26 | 446 | notifications = ["Thank you for your bug report."] | 449 | notifications = [self.getAcknowledgementMessage(self.context)] |
27 | 447 | params = CreateBugParams( | 450 | params = CreateBugParams( |
28 | 448 | title=title, comment=comment, owner=self.user, | 451 | title=title, comment=comment, owner=self.user, |
29 | 449 | security_related=security_related, private=private, | 452 | security_related=security_related, private=private, |
30 | @@ -775,6 +778,47 @@ | |||
31 | 775 | }) | 778 | }) |
32 | 776 | return guidelines | 779 | return guidelines |
33 | 777 | 780 | ||
34 | 781 | default_bug_reported_acknowledgement = "Thank you for your bug report." | ||
35 | 782 | |||
36 | 783 | def getAcknowledgementMessage(self, context): | ||
37 | 784 | """An acknowlegement message displayed to the user.""" | ||
38 | 785 | # If a given context doesnot have a custom message, we go up in the | ||
39 | 786 | # "object hierachy" until we find one. If no cusotmized messages | ||
40 | 787 | # exist for any conext, a default message is returned. | ||
41 | 788 | # | ||
42 | 789 | # bug_reported_acknowledgement is defined as a "real" property | ||
43 | 790 | # for IDistribution, IDistributionSourcePackage, IProduct and | ||
44 | 791 | # IProjectGroup. Other IBugTarget implementations inherit this | ||
45 | 792 | # property from their parents. For these classes, we can directly | ||
46 | 793 | # try to find a custom message farther up in the hierarchy. | ||
47 | 794 | message = context.bug_reported_acknowledgement | ||
48 | 795 | if message is not None and len(message.strip()) > 0: | ||
49 | 796 | return message | ||
50 | 797 | next_context = None | ||
51 | 798 | if IProductSeries.providedBy(context): | ||
52 | 799 | # we don't need to look at | ||
53 | 800 | # context.product.bug_reported_acknowledgement because a | ||
54 | 801 | # product series inherits this property from the product. | ||
55 | 802 | next_context = context.product.project | ||
56 | 803 | elif IProduct.providedBy(context): | ||
57 | 804 | next_context = context.project | ||
58 | 805 | elif IDistributionSourcePackage.providedBy(context): | ||
59 | 806 | next_context = context.distribution | ||
60 | 807 | # IDistroseries and ISourcePackage inherit | ||
61 | 808 | # bug_reported_acknowledgement from their IDistribution, so we | ||
62 | 809 | # don't need to look up this property in IDistribution. | ||
63 | 810 | # IDistribution and IProjectGroup don't have any parents. | ||
64 | 811 | elif (IDistribution.providedBy(context) or | ||
65 | 812 | IProjectGroup.providedBy(context) or | ||
66 | 813 | IDistroSeries.providedBy(context) or | ||
67 | 814 | ISourcePackage.providedBy(context)): | ||
68 | 815 | pass | ||
69 | 816 | else: | ||
70 | 817 | raise TypeError("Unexpected bug target: %r" % context) | ||
71 | 818 | if next_context is not None: | ||
72 | 819 | return self.getAcknowledgementMessage(next_context) | ||
73 | 820 | return self.default_bug_reported_acknowledgement | ||
74 | 821 | |||
75 | 778 | @cachedproperty | 822 | @cachedproperty |
76 | 779 | def extra_data_processing_job(self): | 823 | def extra_data_processing_job(self): |
77 | 780 | """Return the ProcessApportBlobJob for a given BLOB token.""" | 824 | """Return the ProcessApportBlobJob for a given BLOB token.""" |
78 | 781 | 825 | ||
79 | === modified file 'lib/lp/bugs/browser/tests/test_bugtarget_configure.py' | |||
80 | --- lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-05-26 18:52:31 +0000 | |||
81 | +++ lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-06-16 08:24:32 +0000 | |||
82 | @@ -31,6 +31,7 @@ | |||
83 | 31 | 'field.enable_bug_expiration': 'on', | 31 | 'field.enable_bug_expiration': 'on', |
84 | 32 | 'field.remote_product': 'sf-boing', | 32 | 'field.remote_product': 'sf-boing', |
85 | 33 | 'field.bug_reporting_guidelines': 'guidelines', | 33 | 'field.bug_reporting_guidelines': 'guidelines', |
86 | 34 | 'field.bug_reported_acknowledgement': 'acknowledgement message', | ||
87 | 34 | 'field.actions.change': 'Change', | 35 | 'field.actions.change': 'Change', |
88 | 35 | } | 36 | } |
89 | 36 | 37 | ||
90 | @@ -42,7 +43,7 @@ | |||
91 | 42 | fields = [ | 43 | fields = [ |
92 | 43 | 'bug_supervisor', 'security_contact', 'bugtracker', | 44 | 'bug_supervisor', 'security_contact', 'bugtracker', |
93 | 44 | 'enable_bug_expiration', 'remote_product', | 45 | 'enable_bug_expiration', 'remote_product', |
95 | 45 | 'bug_reporting_guidelines'] | 46 | 'bug_reporting_guidelines', 'bug_reported_acknowledgement'] |
96 | 46 | self.assertEqual(fields, view.field_names) | 47 | self.assertEqual(fields, view.field_names) |
97 | 47 | self.assertEqual('http://launchpad.dev/boing', view.next_url) | 48 | self.assertEqual('http://launchpad.dev/boing', view.next_url) |
98 | 48 | self.assertEqual('http://launchpad.dev/boing', view.cancel_url) | 49 | self.assertEqual('http://launchpad.dev/boing', view.cancel_url) |
99 | @@ -61,6 +62,9 @@ | |||
100 | 61 | self.assertTrue(self.product.enable_bug_expiration) | 62 | self.assertTrue(self.product.enable_bug_expiration) |
101 | 62 | self.assertEqual('sf-boing', self.product.remote_product) | 63 | self.assertEqual('sf-boing', self.product.remote_product) |
102 | 63 | self.assertEqual('guidelines', self.product.bug_reporting_guidelines) | 64 | self.assertEqual('guidelines', self.product.bug_reporting_guidelines) |
103 | 65 | self.assertEqual( | ||
104 | 66 | 'acknowledgement message', | ||
105 | 67 | self.product.bug_reported_acknowledgement) | ||
106 | 64 | 68 | ||
107 | 65 | def test_bug_supervisor_invalid(self): | 69 | def test_bug_supervisor_invalid(self): |
108 | 66 | # Verify that invalid bug_supervisor states are reported. | 70 | # Verify that invalid bug_supervisor states are reported. |
109 | 67 | 71 | ||
110 | === added file 'lib/lp/bugs/browser/tests/test_bugtarget_filebug.py' | |||
111 | --- lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 1970-01-01 00:00:00 +0000 | |||
112 | +++ lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2010-06-16 08:24:32 +0000 | |||
113 | @@ -0,0 +1,264 @@ | |||
114 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
115 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
116 | 3 | |||
117 | 4 | __metaclass__ = type | ||
118 | 5 | |||
119 | 6 | |||
120 | 7 | import unittest | ||
121 | 8 | |||
122 | 9 | from canonical.launchpad.ftests import login | ||
123 | 10 | from canonical.launchpad.webapp.servers import LaunchpadTestRequest | ||
124 | 11 | from canonical.testing import LaunchpadFunctionalLayer | ||
125 | 12 | |||
126 | 13 | from lp.bugs.browser.bugtarget import FileBugInlineFormView | ||
127 | 14 | from lp.testing import login_person, TestCaseWithFactory | ||
128 | 15 | from lp.testing.views import create_initialized_view | ||
129 | 16 | |||
130 | 17 | class TestBugTargetFileBugConfirmationMessage(TestCaseWithFactory): | ||
131 | 18 | |||
132 | 19 | layer = LaunchpadFunctionalLayer | ||
133 | 20 | |||
134 | 21 | def setUp(self): | ||
135 | 22 | super(TestBugTargetFileBugConfirmationMessage, self).setUp() | ||
136 | 23 | login('foo.bar@canonical.com') | ||
137 | 24 | self.product = self.factory.makeProduct() | ||
138 | 25 | |||
139 | 26 | def test_getAcknowledgementMessage_product(self): | ||
140 | 27 | # If there is not customized confirmation message, a default | ||
141 | 28 | # message is displayed. | ||
142 | 29 | product = self.factory.makeProduct() | ||
143 | 30 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
144 | 31 | self.assertEqual( | ||
145 | 32 | u"Thank you for your bug report.", | ||
146 | 33 | view.getAcknowledgementMessage(product)) | ||
147 | 34 | |||
148 | 35 | # If a product contains a customized bug filing confirmation | ||
149 | 36 | # message, it is retrieved by | ||
150 | 37 | # FilebugViewBase.bug_reported_acknowledgement | ||
151 | 38 | product.bug_reported_acknowledgement = ( | ||
152 | 39 | u"We really appreciate your bug report") | ||
153 | 40 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
154 | 41 | self.assertEqual( | ||
155 | 42 | u"We really appreciate your bug report", | ||
156 | 43 | view.getAcknowledgementMessage(product)) | ||
157 | 44 | |||
158 | 45 | # If the custom message is set to a string containing only white, | ||
159 | 46 | # space, the default message is used again. | ||
160 | 47 | product.bug_reported_acknowledgement = ' \t' | ||
161 | 48 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
162 | 49 | self.assertEqual( | ||
163 | 50 | u"Thank you for your bug report.", | ||
164 | 51 | view.getAcknowledgementMessage(product)) | ||
165 | 52 | |||
166 | 53 | def test_getAcknowledgementMessage_product_in_project_group(self): | ||
167 | 54 | # If a product is part of a project group and if the project | ||
168 | 55 | # group has a customized bug filing confirmation message, | ||
169 | 56 | # this message is displayed. | ||
170 | 57 | project_group = self.factory.makeProject() | ||
171 | 58 | product = self.factory.makeProduct(project=project_group) | ||
172 | 59 | |||
173 | 60 | # Without any customized bug filing confirmation message, the | ||
174 | 61 | # default message is used. | ||
175 | 62 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
176 | 63 | self.assertEqual( | ||
177 | 64 | u"Thank you for your bug report.", | ||
178 | 65 | view.getAcknowledgementMessage(product)) | ||
179 | 66 | |||
180 | 67 | # If the project group has a customized message, it is used. | ||
181 | 68 | project_group.bug_reported_acknowledgement = ( | ||
182 | 69 | "Thanks for filing a bug for one of our many products.") | ||
183 | 70 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
184 | 71 | self.assertEqual( | ||
185 | 72 | u"Thanks for filing a bug for one of our many products.", | ||
186 | 73 | view.getAcknowledgementMessage(product)) | ||
187 | 74 | |||
188 | 75 | # But if the product itself has a customized message too, this | ||
189 | 76 | # message is used instead of the project group's message. | ||
190 | 77 | product.bug_reported_acknowledgement = ( | ||
191 | 78 | u"Thanks for filing a bug for this very special product.") | ||
192 | 79 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
193 | 80 | self.assertEqual( | ||
194 | 81 | u"Thanks for filing a bug for this very special product.", | ||
195 | 82 | view.getAcknowledgementMessage(product)) | ||
196 | 83 | |||
197 | 84 | def test_getAcknowledgementMessage_product_series(self): | ||
198 | 85 | # If there is not customized confirmation message, a default | ||
199 | 86 | # message is displayed. | ||
200 | 87 | product_series = self.factory.makeProductSeries() | ||
201 | 88 | view = FileBugInlineFormView(product_series, LaunchpadTestRequest()) | ||
202 | 89 | self.assertEqual( | ||
203 | 90 | u"Thank you for your bug report.", | ||
204 | 91 | view.getAcknowledgementMessage(product_series)) | ||
205 | 92 | |||
206 | 93 | # If a product contains a customized bug filing confirmation | ||
207 | 94 | # message, it is retrieved for a product series context by | ||
208 | 95 | # FilebugViewBase.bug_reported_acknowledgement | ||
209 | 96 | product_series.product.bug_reported_acknowledgement = ( | ||
210 | 97 | u"We really appreciate your bug report") | ||
211 | 98 | view = FileBugInlineFormView(product_series, LaunchpadTestRequest()) | ||
212 | 99 | self.assertEqual( | ||
213 | 100 | u"We really appreciate your bug report", | ||
214 | 101 | view.getAcknowledgementMessage(product_series)) | ||
215 | 102 | |||
216 | 103 | def test_getAcknowledgementMessage_product_series_in_project_group(self): | ||
217 | 104 | # If a product_series is part of a project group and if the project | ||
218 | 105 | # group has a customized bug filing confirmation message, | ||
219 | 106 | # this message is displayed. | ||
220 | 107 | project_group = self.factory.makeProject() | ||
221 | 108 | product = self.factory.makeProduct(project=project_group) | ||
222 | 109 | product_series = self.factory.makeProductSeries(product=product) | ||
223 | 110 | |||
224 | 111 | # Without any customized bug filing confirmation message, the | ||
225 | 112 | # default message is used. | ||
226 | 113 | view = FileBugInlineFormView(product_series, LaunchpadTestRequest()) | ||
227 | 114 | self.assertEqual( | ||
228 | 115 | u"Thank you for your bug report.", | ||
229 | 116 | view.getAcknowledgementMessage(product_series)) | ||
230 | 117 | |||
231 | 118 | # If the project group has a customized message, it is used. | ||
232 | 119 | project_group.bug_reported_acknowledgement = ( | ||
233 | 120 | u"Thanks for filing a bug for one of our many product_seriess.") | ||
234 | 121 | view = FileBugInlineFormView(product_series, LaunchpadTestRequest()) | ||
235 | 122 | self.assertEqual( | ||
236 | 123 | u"Thanks for filing a bug for one of our many product_seriess.", | ||
237 | 124 | view.getAcknowledgementMessage(product_series)) | ||
238 | 125 | |||
239 | 126 | # But if the product has a customized message too, this | ||
240 | 127 | # message is used instead of the project group's message. | ||
241 | 128 | product.bug_reported_acknowledgement = ( | ||
242 | 129 | u"Thanks for filing a bug for this very special product.") | ||
243 | 130 | view = FileBugInlineFormView(product_series, LaunchpadTestRequest()) | ||
244 | 131 | self.assertEqual( | ||
245 | 132 | u"Thanks for filing a bug for this very special product.", | ||
246 | 133 | view.getAcknowledgementMessage(product_series)) | ||
247 | 134 | |||
248 | 135 | def test_getAcknowledgementMessage_distribution(self): | ||
249 | 136 | # If there is not customized confirmation message, a default | ||
250 | 137 | # message is displayed. | ||
251 | 138 | distribution = self.factory.makeDistribution() | ||
252 | 139 | view = FileBugInlineFormView(distribution, LaunchpadTestRequest()) | ||
253 | 140 | self.assertEqual( | ||
254 | 141 | u"Thank you for your bug report.", | ||
255 | 142 | view.getAcknowledgementMessage(distribution)) | ||
256 | 143 | |||
257 | 144 | # If a distribution contains a customized bug filing confirmation | ||
258 | 145 | # message, it is retrieved by | ||
259 | 146 | # FilebugViewBase.bug_reported_acknowledgement | ||
260 | 147 | distribution.bug_reported_acknowledgement = ( | ||
261 | 148 | u"We really appreciate your bug report") | ||
262 | 149 | view = FileBugInlineFormView(distribution, LaunchpadTestRequest()) | ||
263 | 150 | self.assertEqual( | ||
264 | 151 | u"We really appreciate your bug report", | ||
265 | 152 | view.getAcknowledgementMessage(distribution)) | ||
266 | 153 | |||
267 | 154 | def test_getAcknowledgementMessage_distroseries(self): | ||
268 | 155 | # If there is not customized confirmation message, a default | ||
269 | 156 | # message is displayed. | ||
270 | 157 | distroseries = self.factory.makeDistroSeries() | ||
271 | 158 | view = FileBugInlineFormView(distroseries, LaunchpadTestRequest()) | ||
272 | 159 | self.assertEqual( | ||
273 | 160 | u"Thank you for your bug report.", | ||
274 | 161 | view.getAcknowledgementMessage(distroseries)) | ||
275 | 162 | |||
276 | 163 | # DistroSeries objects do not have their own, independent | ||
277 | 164 | # property bug_reported_acknowledgement; instead, it is | ||
278 | 165 | # acquired from the parent distribution. | ||
279 | 166 | distroseries.distribution.bug_reported_acknowledgement = ( | ||
280 | 167 | u"We really appreciate your bug report") | ||
281 | 168 | view = FileBugInlineFormView(distroseries, LaunchpadTestRequest()) | ||
282 | 169 | self.assertEqual( | ||
283 | 170 | u"We really appreciate your bug report", | ||
284 | 171 | view.getAcknowledgementMessage(distroseries)) | ||
285 | 172 | |||
286 | 173 | def test_getAcknowledgementMessage_sourcepackage(self): | ||
287 | 174 | # If there is not customized confirmation message, a default | ||
288 | 175 | # message is displayed. | ||
289 | 176 | sourcepackage = self.factory.makeSourcePackage() | ||
290 | 177 | view = FileBugInlineFormView(sourcepackage, LaunchpadTestRequest()) | ||
291 | 178 | self.assertEqual( | ||
292 | 179 | u"Thank you for your bug report.", | ||
293 | 180 | view.getAcknowledgementMessage(sourcepackage)) | ||
294 | 181 | |||
295 | 182 | # SourcePackage objects do not have their own, independent | ||
296 | 183 | # property bug_reported_acknowledgement; instead, it is | ||
297 | 184 | # acquired from the parent distribution. | ||
298 | 185 | sourcepackage.distribution.bug_reported_acknowledgement = ( | ||
299 | 186 | u"We really appreciate your bug report") | ||
300 | 187 | view = FileBugInlineFormView(sourcepackage, LaunchpadTestRequest()) | ||
301 | 188 | self.assertEqual( | ||
302 | 189 | u"We really appreciate your bug report", | ||
303 | 190 | view.getAcknowledgementMessage(sourcepackage)) | ||
304 | 191 | |||
305 | 192 | def test_getAcknowledgementMessage_distributionsourcepackage(self): | ||
306 | 193 | # If there is not customized confirmation message, a default | ||
307 | 194 | # message is displayed. | ||
308 | 195 | dsp = self.factory.makeDistributionSourcePackage() | ||
309 | 196 | view = FileBugInlineFormView(dsp, LaunchpadTestRequest()) | ||
310 | 197 | self.assertEqual( | ||
311 | 198 | u"Thank you for your bug report.", | ||
312 | 199 | view.getAcknowledgementMessage(dsp)) | ||
313 | 200 | |||
314 | 201 | # If a custom message is defined for a DSP, it is used instead of | ||
315 | 202 | # the default message. | ||
316 | 203 | dsp.bug_reported_acknowledgement = ( | ||
317 | 204 | u"We really appreciate your bug report") | ||
318 | 205 | view = FileBugInlineFormView(dsp, LaunchpadTestRequest()) | ||
319 | 206 | self.assertEqual( | ||
320 | 207 | u"We really appreciate your bug report", | ||
321 | 208 | view.getAcknowledgementMessage(dsp)) | ||
322 | 209 | |||
323 | 210 | def test_getAcknowledgementMessage_dsp_custom_distro_message(self): | ||
324 | 211 | # If a distribution has a customized conformatom message, it | ||
325 | 212 | # is used for bugs filed on DsitributionSourcePackages. | ||
326 | 213 | dsp = self.factory.makeDistributionSourcePackage() | ||
327 | 214 | dsp.distribution.bug_reported_acknowledgement = ( | ||
328 | 215 | u"Thank you for filing a bug in our distribution") | ||
329 | 216 | view = FileBugInlineFormView(dsp, LaunchpadTestRequest()) | ||
330 | 217 | self.assertEqual( | ||
331 | 218 | u"Thank you for filing a bug in our distribution", | ||
332 | 219 | view.getAcknowledgementMessage(dsp)) | ||
333 | 220 | |||
334 | 221 | # Bug if a custom message is defined for a DSP, it is used instead of | ||
335 | 222 | # the message for the distribution. | ||
336 | 223 | dsp.bug_reported_acknowledgement = ( | ||
337 | 224 | u"Thank you for filing a bug for this DSP") | ||
338 | 225 | view = FileBugInlineFormView(dsp, LaunchpadTestRequest()) | ||
339 | 226 | self.assertEqual( | ||
340 | 227 | u"Thank you for filing a bug for this DSP", | ||
341 | 228 | view.getAcknowledgementMessage(dsp)) | ||
342 | 229 | |||
343 | 230 | def test_bug_filed_acknowlegdgement_notification(self): | ||
344 | 231 | # When a user files a bug, an acknowledgement notification is added | ||
345 | 232 | # to the response. | ||
346 | 233 | product = self.factory.makeProduct() | ||
347 | 234 | login_person(product.owner) | ||
348 | 235 | view = FileBugInlineFormView(product, LaunchpadTestRequest()) | ||
349 | 236 | form_data = { | ||
350 | 237 | 'title': 'A bug title', | ||
351 | 238 | 'comment': 'whatever', | ||
352 | 239 | } | ||
353 | 240 | view = create_initialized_view(product, name='+filebug') | ||
354 | 241 | view.submit_bug_action.success(form_data) | ||
355 | 242 | self.assertEqual( | ||
356 | 243 | ["Thank you for your bug report."], | ||
357 | 244 | [notification.message | ||
358 | 245 | for notification in view.request.response.notifications]) | ||
359 | 246 | |||
360 | 247 | # This message can be customized. | ||
361 | 248 | product.bug_reported_acknowledgement = ( | ||
362 | 249 | u"We really appreciate your bug report") | ||
363 | 250 | view = create_initialized_view(product, name='+filebug') | ||
364 | 251 | view.submit_bug_action.success(form_data) | ||
365 | 252 | self.assertEqual( | ||
366 | 253 | [u"We really appreciate your bug report"], | ||
367 | 254 | [notification.message | ||
368 | 255 | for notification in view.request.response.notifications]) | ||
369 | 256 | |||
370 | 257 | def test_suite(): | ||
371 | 258 | suite = unittest.TestSuite() | ||
372 | 259 | suite.addTest(unittest.makeSuite(TestBugTargetFileBugConfirmationMessage)) | ||
373 | 260 | return suite | ||
374 | 261 | |||
375 | 262 | |||
376 | 263 | if __name__ == '__main__': | ||
377 | 264 | unittest.TextTestRunner().run(test_suite()) | ||
378 | 0 | 265 | ||
379 | === modified file 'lib/lp/bugs/stories/guided-filebug/xx-bug-reporting-guidelines.txt' | |||
380 | --- lib/lp/bugs/stories/guided-filebug/xx-bug-reporting-guidelines.txt 2010-03-16 22:07:45 +0000 | |||
381 | +++ lib/lp/bugs/stories/guided-filebug/xx-bug-reporting-guidelines.txt 2010-06-16 08:24:32 +0000 | |||
382 | @@ -1,7 +1,9 @@ | |||
384 | 1 | = Bug Reporting Guidelines = | 1 | = Bug Reporting Guidelines and acknowledgement messages = |
385 | 2 | 2 | ||
386 | 3 | Some helpful explanatory text - guidelines - can be set for | 3 | Some helpful explanatory text - guidelines - can be set for |
388 | 4 | distributions, product groups, products, and source packages. | 4 | distributions, product groups, products, and source packages, as wel |
389 | 5 | as an acknowledgement message that is displayed when a bug has been | ||
390 | 6 | filed. | ||
391 | 5 | 7 | ||
392 | 6 | >>> contexts = [ | 8 | >>> contexts = [ |
393 | 7 | ... ('Ubuntu', 'ubuntu', '+edit'), | 9 | ... ('Ubuntu', 'ubuntu', '+edit'), |
394 | @@ -16,6 +18,9 @@ | |||
395 | 16 | ... admin_browser.getControl( | 18 | ... admin_browser.getControl( |
396 | 17 | ... name='field.bug_reporting_guidelines').value = ( | 19 | ... name='field.bug_reporting_guidelines').value = ( |
397 | 18 | ... "The version of %s you're using." % (context_name,)) | 20 | ... "The version of %s you're using." % (context_name,)) |
398 | 21 | ... admin_browser.getControl( | ||
399 | 22 | ... name='field.bug_reported_acknowledgement').value = ( | ||
400 | 23 | ... "Thank you for filing a bug for %s" % context_name) | ||
401 | 19 | ... if context_path == 'ubuntu': | 24 | ... if context_path == 'ubuntu': |
402 | 20 | ... admin_browser.getControl('Change', index=3).click() | 25 | ... admin_browser.getControl('Change', index=3).click() |
403 | 21 | ... else: | 26 | ... else: |
404 | @@ -30,6 +35,9 @@ | |||
405 | 30 | ... print ' <%s>' % user_browser.url | 35 | ... print ' <%s>' % user_browser.url |
406 | 31 | ... print extract_text(find_tag_by_id( | 36 | ... print extract_text(find_tag_by_id( |
407 | 32 | ... user_browser.contents, 'bug-reporting-guidelines')) | 37 | ... user_browser.contents, 'bug-reporting-guidelines')) |
408 | 38 | >>> def print_acknowledgement_message(browser): | ||
409 | 39 | ... print extract_text(find_tags_by_class( | ||
410 | 40 | ... user_browser.contents, 'informational message')[0]) | ||
411 | 33 | 41 | ||
412 | 34 | >>> for context_name, context_path, view in contexts: | 42 | >>> for context_name, context_path, view in contexts: |
413 | 35 | ... filebug_url = ( | 43 | ... filebug_url = ( |
414 | @@ -49,22 +57,29 @@ | |||
415 | 49 | ... user_browser.open(filebug_url) | 57 | ... user_browser.open(filebug_url) |
416 | 50 | ... user_browser.getControl('Summary').value = "It doesn't work" | 58 | ... user_browser.getControl('Summary').value = "It doesn't work" |
417 | 51 | ... user_browser.getControl('Continue').click() | 59 | ... user_browser.getControl('Continue').click() |
418 | 60 | ... user_browser.getControl('Further information').value = ( | ||
419 | 61 | ... 'please help!') | ||
420 | 52 | ... print_guidelines(context_name, user_browser) | 62 | ... print_guidelines(context_name, user_browser) |
421 | 63 | ... user_browser.getControl('Submit Bug Report').click() | ||
422 | 64 | ... print_acknowledgement_message(user_browser) | ||
423 | 53 | * | 65 | * |
424 | 54 | Ubuntu | 66 | Ubuntu |
425 | 55 | <http://launchpad.dev/ubuntu/+filebug> | 67 | <http://launchpad.dev/ubuntu/+filebug> |
426 | 56 | Ubuntu guidelines: | 68 | Ubuntu guidelines: |
427 | 57 | The version of Ubuntu you're using. | 69 | The version of Ubuntu you're using. |
428 | 70 | Thank you for filing a bug for Ubuntu | ||
429 | 58 | * | 71 | * |
430 | 59 | Mozilla | 72 | Mozilla |
431 | 60 | <http://launchpad.dev/mozilla/+filebug> | 73 | <http://launchpad.dev/mozilla/+filebug> |
432 | 61 | The Mozilla Project guidelines: | 74 | The Mozilla Project guidelines: |
433 | 62 | The version of Mozilla you're using. | 75 | The version of Mozilla you're using. |
434 | 76 | Thank you for filing a bug for Mozilla | ||
435 | 63 | * | 77 | * |
436 | 64 | Firefox | 78 | Firefox |
437 | 65 | <http://launchpad.dev/firefox/+filebug> | 79 | <http://launchpad.dev/firefox/+filebug> |
438 | 66 | Mozilla Firefox guidelines: | 80 | Mozilla Firefox guidelines: |
439 | 67 | The version of Firefox you're using. | 81 | The version of Firefox you're using. |
440 | 82 | Thank you for filing a bug for Firefox | ||
441 | 68 | * | 83 | * |
442 | 69 | alsa-utils in Ubuntu | 84 | alsa-utils in Ubuntu |
443 | 70 | <http://launchpad.dev/ubuntu/+source/alsa-utils/+filebug> | 85 | <http://launchpad.dev/ubuntu/+source/alsa-utils/+filebug> |
444 | @@ -72,6 +87,7 @@ | |||
445 | 72 | The version of alsa-utils in Ubuntu you're using. | 87 | The version of alsa-utils in Ubuntu you're using. |
446 | 73 | Ubuntu guidelines: | 88 | Ubuntu guidelines: |
447 | 74 | The version of Ubuntu you're using. | 89 | The version of Ubuntu you're using. |
448 | 90 | Thank you for filing a bug for alsa-utils in Ubuntu | ||
449 | 75 | 91 | ||
450 | 76 | Note how the alsa-utils in Ubuntu specific guidelines were displayed | 92 | Note how the alsa-utils in Ubuntu specific guidelines were displayed |
451 | 77 | followed by the general Ubuntu guidelines. | 93 | followed by the general Ubuntu guidelines. |
452 | 78 | 94 | ||
453 | === modified file 'lib/lp/registry/browser/distribution.py' | |||
454 | --- lib/lp/registry/browser/distribution.py 2010-05-14 08:05:23 +0000 | |||
455 | +++ lib/lp/registry/browser/distribution.py 2010-06-16 08:24:32 +0000 | |||
456 | @@ -767,7 +767,8 @@ | |||
457 | 767 | 767 | ||
458 | 768 | schema = IDistribution | 768 | schema = IDistribution |
459 | 769 | field_names = ['displayname', 'title', 'summary', 'description', | 769 | field_names = ['displayname', 'title', 'summary', 'description', |
461 | 770 | 'bug_reporting_guidelines', 'icon', 'logo', 'mugshot', | 770 | 'bug_reporting_guidelines', 'bug_reported_acknowledgement', |
462 | 771 | 'icon', 'logo', 'mugshot', | ||
463 | 771 | 'official_malone', 'enable_bug_expiration', | 772 | 'official_malone', 'enable_bug_expiration', |
464 | 772 | 'official_blueprints', 'official_rosetta', | 773 | 'official_blueprints', 'official_rosetta', |
465 | 773 | 'official_answers', 'translation_focus', ] | 774 | 'official_answers', 'translation_focus', ] |
466 | 774 | 775 | ||
467 | === modified file 'lib/lp/registry/browser/distributionsourcepackage.py' | |||
468 | --- lib/lp/registry/browser/distributionsourcepackage.py 2010-03-03 19:15:17 +0000 | |||
469 | +++ lib/lp/registry/browser/distributionsourcepackage.py 2010-06-16 08:24:32 +0000 | |||
470 | @@ -478,6 +478,7 @@ | |||
471 | 478 | schema = IDistributionSourcePackage | 478 | schema = IDistributionSourcePackage |
472 | 479 | field_names = [ | 479 | field_names = [ |
473 | 480 | 'bug_reporting_guidelines', | 480 | 'bug_reporting_guidelines', |
474 | 481 | 'bug_reported_acknowledgement', | ||
475 | 481 | ] | 482 | ] |
476 | 482 | 483 | ||
477 | 483 | @property | 484 | @property |
478 | 484 | 485 | ||
479 | === modified file 'lib/lp/registry/browser/project.py' | |||
480 | --- lib/lp/registry/browser/project.py 2010-05-11 17:43:20 +0000 | |||
481 | +++ lib/lp/registry/browser/project.py 2010-06-16 08:24:32 +0000 | |||
482 | @@ -324,8 +324,9 @@ | |||
483 | 324 | schema = IProjectGroup | 324 | schema = IProjectGroup |
484 | 325 | field_names = [ | 325 | field_names = [ |
485 | 326 | 'name', 'displayname', 'title', 'summary', 'description', | 326 | 'name', 'displayname', 'title', 'summary', 'description', |
488 | 327 | 'bug_reporting_guidelines', 'homepageurl', 'bugtracker', | 327 | 'bug_reporting_guidelines', 'bug_reported_acknowledgement', |
489 | 328 | 'sourceforgeproject', 'freshmeatproject', 'wikiurl'] | 328 | 'homepageurl', 'bugtracker', 'sourceforgeproject', |
490 | 329 | 'freshmeatproject', 'wikiurl'] | ||
491 | 329 | 330 | ||
492 | 330 | 331 | ||
493 | 331 | @action('Change Details', name='change') | 332 | @action('Change Details', name='change') |
494 | 332 | 333 | ||
495 | === modified file 'lib/lp/registry/browser/tests/distribution-views.txt' | |||
496 | --- lib/lp/registry/browser/tests/distribution-views.txt 2010-05-19 16:58:45 +0000 | |||
497 | +++ lib/lp/registry/browser/tests/distribution-views.txt 2010-06-16 08:24:32 +0000 | |||
498 | @@ -111,9 +111,10 @@ | |||
499 | 111 | 111 | ||
500 | 112 | >>> view.field_names | 112 | >>> view.field_names |
501 | 113 | ['displayname', 'title', 'summary', 'description', | 113 | ['displayname', 'title', 'summary', 'description', |
505 | 114 | 'bug_reporting_guidelines', 'icon', 'logo', 'mugshot', 'official_malone', | 114 | 'bug_reporting_guidelines', 'bug_reported_acknowledgement', 'icon', |
506 | 115 | 'enable_bug_expiration', 'official_blueprints', 'official_rosetta', | 115 | 'logo', 'mugshot', 'official_malone', 'enable_bug_expiration', |
507 | 116 | 'official_answers', 'translation_focus'] | 116 | 'official_blueprints', 'official_rosetta', 'official_answers', |
508 | 117 | 'translation_focus'] | ||
509 | 117 | 118 | ||
510 | 118 | >>> del form['field.name'] | 119 | >>> del form['field.name'] |
511 | 119 | >>> del form['field.actions.save'] | 120 | >>> del form['field.actions.save'] |
512 | 120 | 121 | ||
513 | === modified file 'lib/lp/registry/browser/tests/distributionsourcepackage-views.txt' | |||
514 | --- lib/lp/registry/browser/tests/distributionsourcepackage-views.txt 2009-12-13 11:55:40 +0000 | |||
515 | +++ lib/lp/registry/browser/tests/distributionsourcepackage-views.txt 2010-06-16 08:24:32 +0000 | |||
516 | @@ -165,7 +165,7 @@ | |||
517 | 165 | The view allows the user the set the bug_reporting_guidelines field. | 165 | The view allows the user the set the bug_reporting_guidelines field. |
518 | 166 | 166 | ||
519 | 167 | >>> view.field_names | 167 | >>> view.field_names |
521 | 168 | ['bug_reporting_guidelines'] | 168 | ['bug_reporting_guidelines', 'bug_reported_acknowledgement'] |
522 | 169 | 169 | ||
523 | 170 | >>> print package.bug_reporting_guidelines | 170 | >>> print package.bug_reporting_guidelines |
524 | 171 | None | 171 | None |
> + "bug_reported_ acknowledgement ", widget( 'bugtracker' , ProductBugTrack erWidget) ledgementMessag e(self. context) ] related= security_ related, private=private, bug_reported_ acknowledgement = "Thank you for your bug report." entMessage( self, context):
> ]
> custom_
>
> @@ -443,7 +446,7 @@
> else:
> private = False
>
> - notifications = ["Thank you for your bug report."]
> + notifications = [self.getAcknow
> params = CreateBugParams(
> title=title, comment=comment, owner=self.user,
> security_
> @@ -775,6 +778,47 @@
> })
> return guidelines
>
> + default_
> +
> + def getAcknowledgem
> + """An acknowlegement message displayed to the user."""
> + # If a given context has not a custom message, we go up in the
Minor grammatical nit pick: "does not have a" reads better than "has not a".