Merge lp:~intellectronica/launchpad/expectations-bug-556499-model into lp:launchpad/db-devel

Proposed by Eleanor Berger
Status: Merged
Merge reported by: Deryck Hodge
Merged at revision: not available
Proposed branch: lp:~intellectronica/launchpad/expectations-bug-556499-model
Merge into: lp:launchpad/db-devel
Diff against target: 295 lines (+168/-3)
10 files modified
lib/lp/bugs/doc/bug-reported-acknowledgement.txt (+122/-0)
lib/lp/bugs/interfaces/bugtarget.py (+10/-0)
lib/lp/registry/configure.zcml (+8/-3)
lib/lp/registry/interfaces/projectgroup.py (+10/-0)
lib/lp/registry/model/distribution.py (+1/-0)
lib/lp/registry/model/distroseries.py (+5/-0)
lib/lp/registry/model/product.py (+1/-0)
lib/lp/registry/model/productseries.py (+5/-0)
lib/lp/registry/model/projectgroup.py (+1/-0)
lib/lp/registry/model/sourcepackage.py (+5/-0)
To merge this branch: bzr merge lp:~intellectronica/launchpad/expectations-bug-556499-model
Reviewer Review Type Date Requested Status
Leonard Richardson (community) code Approve
Review via email: mp+25896@code.launchpad.net

Commit message

Model for IBugTarget.bug_reported_acknowledgement.

Description of the change

This branch has the model changes for recording an acknowledgement message to display to users after they've filed a bug. The database field is already in db-devel, and the UI follows in another branch.

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/lp/bugs/doc/bug-reported-acknowledgement.txt'
2--- lib/lp/bugs/doc/bug-reported-acknowledgement.txt 1970-01-01 00:00:00 +0000
3+++ lib/lp/bugs/doc/bug-reported-acknowledgement.txt 2010-05-24 14:27:31 +0000
4@@ -0,0 +1,122 @@
5+= Bug Reported Acknowledgement Message =
6+
7+A message of acknowledgement to be displayed to bug reporters after they've
8+reported a bug can be set at the Distribution, DistributionSourcePackage,
9+ProjectGroup or Product level to help users file good bug reports, direct
10+them to FAQs, and so forth.
11+
12+ >>> login('foo.bar@canonical.com')
13+
14+ >>> from canonical.launchpad.interfaces import (
15+ ... IDistributionSet, IProjectGroupSet, IProductSet)
16+
17+ >>> distribution = getUtility(IDistributionSet).getByName('ubuntu')
18+ >>> distribution_source_package = (
19+ ... distribution.getSourcePackage('alsa-utils'))
20+ >>> project = getUtility(IProjectGroupSet).getByName('mozilla')
21+ >>> product = getUtility(IProductSet).getByName('firefox')
22+
23+ >>> settable_contexts = [
24+ ... distribution,
25+ ... distribution_source_package,
26+ ... project,
27+ ... product,
28+ ... ]
29+
30+ >>> for context in settable_contexts:
31+ ... context.bug_reported_acknowledgement = (
32+ ... "Bug reported on %s." % context.displayname)
33+
34+In fact, all IBugTargets have an acknowledgement message available, but the
35+others delegate to the distribution or product level.
36+
37+DistroSeries and SourcePackages defer to the Distribution:
38+
39+ >>> distro_series = distribution.getSeries('warty')
40+ >>> print distro_series.bug_reported_acknowledgement
41+ Bug reported on Ubuntu.
42+
43+ >>> source_package = distro_series.getSourcePackage('alsa-utils')
44+ >>> print source_package.bug_reported_acknowledgement
45+ Bug reported on Ubuntu.
46+
47+ProductSeries defer to the Product:
48+
49+ >>> product_series = product.getSeries('trunk')
50+ >>> print product_series.bug_reported_acknowledgement
51+ Bug reported on Mozilla Firefox.
52+
53+One day these objects that defer bug_reported_acknowledgement may have
54+their own message. In the meantime the deferral is done with a
55+read-only property, and the security proxies also only allow read
56+access.
57+
58+ >>> distro_series.bug_reported_acknowledgement = 'Foobar'
59+ Traceback (most recent call last):
60+ ...
61+ ForbiddenAttribute: ...
62+
63+ >>> source_package.bug_reported_acknowledgement = 'Foobar'
64+ Traceback (most recent call last):
65+ ...
66+ ForbiddenAttribute: ...
67+
68+ >>> product_series.bug_reported_acknowledgement = 'Foobar'
69+ Traceback (most recent call last):
70+ ...
71+ ForbiddenAttribute: ...
72+
73+The security proxies also prevent unprivileged users from editing the
74+message.
75+
76+ >>> from canonical.launchpad.interfaces import IPerson
77+
78+ >>> def check_access(user, context):
79+ ... if IPerson.providedBy(user):
80+ ... login_person(user)
81+ ... else:
82+ ... login(user)
83+ ... context.bug_reported_acknowledgement = (
84+ ... "%s let %s have access." % (
85+ ... context.displayname,
86+ ... getUtility(ILaunchBag).user.displayname))
87+ ... print context.bug_reported_acknowledgement
88+
89+ >>> check_access("no-priv@canonical.com", distribution)
90+ Traceback (most recent call last):
91+ ...
92+ Unauthorized: ...
93+
94+ >>> check_access("no-priv@canonical.com", distribution_source_package)
95+ Traceback (most recent call last):
96+ ...
97+ Unauthorized: ...
98+
99+ >>> check_access("no-priv@canonical.com", project)
100+ Traceback (most recent call last):
101+ ...
102+ Unauthorized: ...
103+
104+ >>> check_access("no-priv@canonical.com", product)
105+ Traceback (most recent call last):
106+ ...
107+ Unauthorized: ...
108+
109+Of course the owner can edit the message.
110+
111+ >>> check_access(distribution.owner.activemembers[0], distribution)
112+ Ubuntu let Alexander Limi have access.
113+
114+ >>> check_access(project.owner, project)
115+ the Mozilla Project let Sample Person have access.
116+
117+ >>> check_access(product.owner, product)
118+ Mozilla Firefox let Sample Person have access.
119+
120+In the case of DistributionSourcePackages, the owner of the
121+Distribution can edit the message.
122+
123+ >>> check_access(
124+ ... distribution_source_package.distribution.owner.activemembers[0],
125+ ... distribution_source_package)
126+ alsa-utils in ubuntu let Alexander Limi have access.
127
128=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
129--- lib/lp/bugs/interfaces/bugtarget.py 2010-05-06 01:46:55 +0000
130+++ lib/lp/bugs/interfaces/bugtarget.py 2010-05-24 14:27:31 +0000
131@@ -237,6 +237,16 @@
132 required=False,
133 max_length=50000))
134
135+ bug_reported_acknowledgement = exported(
136+ Text(
137+ title=(
138+ u"After reporting a bug, I can expect the following."),
139+ description=(
140+ u"This message of acknowledgement will be displayed "
141+ "to anyone after reporting a bug."),
142+ required=False,
143+ max_length=50000))
144+
145 def createBug(bug_params):
146 """Create a new bug on this target.
147
148
149=== modified file 'lib/lp/registry/configure.zcml'
150--- lib/lp/registry/configure.zcml 2010-04-27 13:57:18 +0000
151+++ lib/lp/registry/configure.zcml 2010-05-24 14:27:31 +0000
152@@ -382,6 +382,7 @@
153 publishing_history
154 current_publishing_records
155 bug_reporting_guidelines
156+ bug_reported_acknowledgement
157 latest_overall_publication
158 __getitem__
159 getVersion
160@@ -446,7 +447,9 @@
161 removeAnswerContact"/>
162 <require
163 permission="launchpad.Edit"
164- set_attributes="bug_reporting_guidelines"/>
165+ set_attributes="
166+ bug_reported_acknowledgement
167+ bug_reporting_guidelines"/>
168 </class>
169 <adapter
170 for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
171@@ -1088,7 +1091,8 @@
172 interface="lp.registry.interfaces.product.IProductEditRestricted"/>
173 <require
174 permission="launchpad.Edit"
175- set_attributes="bug_reporting_guidelines bugtracker
176+ set_attributes="bug_reporting_guidelines
177+ bug_reported_acknowledgement bugtracker
178 commercial_subscription description
179 development_focus displayname downloadurl
180 driver enable_bug_expiration
181@@ -1407,7 +1411,8 @@
182 displayname title summary description driver
183 members owner security_contact mirror_admin homepage_content
184 icon logo mugshot enable_bug_expiration
185- bug_reporting_guidelines official_blueprints official_malone
186+ bug_reporting_guidelines bug_reported_acknowledgement
187+ official_blueprints official_malone
188 official_rosetta official_answers official_bug_tags"/>
189 <require
190 permission="launchpad.TranslationsAdmin"
191
192=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
193--- lib/lp/registry/interfaces/projectgroup.py 2010-04-19 08:30:06 +0000
194+++ lib/lp/registry/interfaces/projectgroup.py 2010-05-24 14:27:31 +0000
195@@ -261,6 +261,16 @@
196 required=False,
197 max_length=50000))
198
199+ bug_reported_acknowledgement = exported(
200+ Text(
201+ title=(
202+ u"After reporting a bug, I can expect the following."),
203+ description=(
204+ u"This message of acknowledgement will be displayed "
205+ "to anyone after reporting a bug."),
206+ required=False,
207+ max_length=50000))
208+
209 def getProduct(name):
210 """Get a product with name `name`."""
211
212
213=== modified file 'lib/lp/registry/model/distribution.py'
214--- lib/lp/registry/model/distribution.py 2010-05-07 20:09:03 +0000
215+++ lib/lp/registry/model/distribution.py 2010-05-24 14:27:31 +0000
216@@ -156,6 +156,7 @@
217 notNull=False,
218 default=None)
219 bug_reporting_guidelines = StringCol(default=None)
220+ bug_reported_acknowledgement = StringCol(default=None)
221 security_contact = ForeignKey(
222 dbName='security_contact', foreignKey='Person',
223 storm_validator=validate_public_person, notNull=False,
224
225=== modified file 'lib/lp/registry/model/distroseries.py'
226--- lib/lp/registry/model/distroseries.py 2010-05-12 23:23:19 +0000
227+++ lib/lp/registry/model/distroseries.py 2010-05-24 14:27:31 +0000
228@@ -505,6 +505,11 @@
229 """See `IBugTarget`."""
230 return self.distribution.bug_reporting_guidelines
231
232+ @property
233+ def bug_reported_acknowledgement(self):
234+ """See `IBugTarget`."""
235+ return self.distribution.bug_reported_acknowledgement
236+
237 def _getMilestoneCondition(self):
238 """See `HasMilestonesMixin`."""
239 return (Milestone.distroseries == self)
240
241=== modified file 'lib/lp/registry/model/product.py'
242--- lib/lp/registry/model/product.py 2010-04-27 13:57:18 +0000
243+++ lib/lp/registry/model/product.py 2010-05-24 14:27:31 +0000
244@@ -288,6 +288,7 @@
245 foreignKey="ProductSeries", dbName="development_focus", notNull=False,
246 default=None)
247 bug_reporting_guidelines = StringCol(default=None)
248+ bug_reported_acknowledgement = StringCol(default=None)
249 _cached_licenses = None
250
251 def _validate_active(self, attr, value):
252
253=== modified file 'lib/lp/registry/model/productseries.py'
254--- lib/lp/registry/model/productseries.py 2010-03-24 02:53:42 +0000
255+++ lib/lp/registry/model/productseries.py 2010-05-24 14:27:31 +0000
256@@ -181,6 +181,11 @@
257 return self.product.bug_reporting_guidelines
258
259 @property
260+ def bug_reported_acknowledgement(self):
261+ """See `IBugTarget`."""
262+ return self.product.bug_reported_acknowledgement
263+
264+ @property
265 def sourcepackages(self):
266 """See IProductSeries"""
267 from lp.registry.model.sourcepackage import SourcePackage
268
269=== modified file 'lib/lp/registry/model/projectgroup.py'
270--- lib/lp/registry/model/projectgroup.py 2010-04-16 15:06:55 +0000
271+++ lib/lp/registry/model/projectgroup.py 2010-05-24 14:27:31 +0000
272@@ -123,6 +123,7 @@
273 foreignKey="BugTracker", dbName="bugtracker", notNull=False,
274 default=None)
275 bug_reporting_guidelines = StringCol(default=None)
276+ bug_reported_acknowledgement = StringCol(default=None)
277 max_bug_heat = Int()
278
279 # convenient joins
280
281=== modified file 'lib/lp/registry/model/sourcepackage.py'
282--- lib/lp/registry/model/sourcepackage.py 2010-04-14 18:31:51 +0000
283+++ lib/lp/registry/model/sourcepackage.py 2010-05-24 14:27:31 +0000
284@@ -427,6 +427,11 @@
285 """See `IBugTarget`."""
286 return self.distribution.bug_reporting_guidelines
287
288+ @property
289+ def bug_reported_acknowledgement(self):
290+ """See `IBugTarget`."""
291+ return self.distribution.bug_reported_acknowledgement
292+
293 def _customizeSearchParams(self, search_params):
294 """Customize `search_params` for this source package."""
295 search_params.setSourcePackage(self)

Subscribers

People subscribed via source and target branches

to status/vote changes: