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
=== added file 'lib/lp/bugs/doc/bug-reported-acknowledgement.txt'
--- lib/lp/bugs/doc/bug-reported-acknowledgement.txt 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/doc/bug-reported-acknowledgement.txt 2010-05-24 14:27:31 +0000
@@ -0,0 +1,122 @@
1= Bug Reported Acknowledgement Message =
2
3A message of acknowledgement to be displayed to bug reporters after they've
4reported a bug can be set at the Distribution, DistributionSourcePackage,
5ProjectGroup or Product level to help users file good bug reports, direct
6them to FAQs, and so forth.
7
8 >>> login('foo.bar@canonical.com')
9
10 >>> from canonical.launchpad.interfaces import (
11 ... IDistributionSet, IProjectGroupSet, IProductSet)
12
13 >>> distribution = getUtility(IDistributionSet).getByName('ubuntu')
14 >>> distribution_source_package = (
15 ... distribution.getSourcePackage('alsa-utils'))
16 >>> project = getUtility(IProjectGroupSet).getByName('mozilla')
17 >>> product = getUtility(IProductSet).getByName('firefox')
18
19 >>> settable_contexts = [
20 ... distribution,
21 ... distribution_source_package,
22 ... project,
23 ... product,
24 ... ]
25
26 >>> for context in settable_contexts:
27 ... context.bug_reported_acknowledgement = (
28 ... "Bug reported on %s." % context.displayname)
29
30In fact, all IBugTargets have an acknowledgement message available, but the
31others delegate to the distribution or product level.
32
33DistroSeries and SourcePackages defer to the Distribution:
34
35 >>> distro_series = distribution.getSeries('warty')
36 >>> print distro_series.bug_reported_acknowledgement
37 Bug reported on Ubuntu.
38
39 >>> source_package = distro_series.getSourcePackage('alsa-utils')
40 >>> print source_package.bug_reported_acknowledgement
41 Bug reported on Ubuntu.
42
43ProductSeries defer to the Product:
44
45 >>> product_series = product.getSeries('trunk')
46 >>> print product_series.bug_reported_acknowledgement
47 Bug reported on Mozilla Firefox.
48
49One day these objects that defer bug_reported_acknowledgement may have
50their own message. In the meantime the deferral is done with a
51read-only property, and the security proxies also only allow read
52access.
53
54 >>> distro_series.bug_reported_acknowledgement = 'Foobar'
55 Traceback (most recent call last):
56 ...
57 ForbiddenAttribute: ...
58
59 >>> source_package.bug_reported_acknowledgement = 'Foobar'
60 Traceback (most recent call last):
61 ...
62 ForbiddenAttribute: ...
63
64 >>> product_series.bug_reported_acknowledgement = 'Foobar'
65 Traceback (most recent call last):
66 ...
67 ForbiddenAttribute: ...
68
69The security proxies also prevent unprivileged users from editing the
70message.
71
72 >>> from canonical.launchpad.interfaces import IPerson
73
74 >>> def check_access(user, context):
75 ... if IPerson.providedBy(user):
76 ... login_person(user)
77 ... else:
78 ... login(user)
79 ... context.bug_reported_acknowledgement = (
80 ... "%s let %s have access." % (
81 ... context.displayname,
82 ... getUtility(ILaunchBag).user.displayname))
83 ... print context.bug_reported_acknowledgement
84
85 >>> check_access("no-priv@canonical.com", distribution)
86 Traceback (most recent call last):
87 ...
88 Unauthorized: ...
89
90 >>> check_access("no-priv@canonical.com", distribution_source_package)
91 Traceback (most recent call last):
92 ...
93 Unauthorized: ...
94
95 >>> check_access("no-priv@canonical.com", project)
96 Traceback (most recent call last):
97 ...
98 Unauthorized: ...
99
100 >>> check_access("no-priv@canonical.com", product)
101 Traceback (most recent call last):
102 ...
103 Unauthorized: ...
104
105Of course the owner can edit the message.
106
107 >>> check_access(distribution.owner.activemembers[0], distribution)
108 Ubuntu let Alexander Limi have access.
109
110 >>> check_access(project.owner, project)
111 the Mozilla Project let Sample Person have access.
112
113 >>> check_access(product.owner, product)
114 Mozilla Firefox let Sample Person have access.
115
116In the case of DistributionSourcePackages, the owner of the
117Distribution can edit the message.
118
119 >>> check_access(
120 ... distribution_source_package.distribution.owner.activemembers[0],
121 ... distribution_source_package)
122 alsa-utils in ubuntu let Alexander Limi have access.
0123
=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
--- lib/lp/bugs/interfaces/bugtarget.py 2010-05-06 01:46:55 +0000
+++ lib/lp/bugs/interfaces/bugtarget.py 2010-05-24 14:27:31 +0000
@@ -237,6 +237,16 @@
237 required=False,237 required=False,
238 max_length=50000))238 max_length=50000))
239239
240 bug_reported_acknowledgement = exported(
241 Text(
242 title=(
243 u"After reporting a bug, I can expect the following."),
244 description=(
245 u"This message of acknowledgement will be displayed "
246 "to anyone after reporting a bug."),
247 required=False,
248 max_length=50000))
249
240 def createBug(bug_params):250 def createBug(bug_params):
241 """Create a new bug on this target.251 """Create a new bug on this target.
242252
243253
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2010-04-27 13:57:18 +0000
+++ lib/lp/registry/configure.zcml 2010-05-24 14:27:31 +0000
@@ -382,6 +382,7 @@
382 publishing_history382 publishing_history
383 current_publishing_records383 current_publishing_records
384 bug_reporting_guidelines384 bug_reporting_guidelines
385 bug_reported_acknowledgement
385 latest_overall_publication386 latest_overall_publication
386 __getitem__387 __getitem__
387 getVersion388 getVersion
@@ -446,7 +447,9 @@
446 removeAnswerContact"/>447 removeAnswerContact"/>
447 <require448 <require
448 permission="launchpad.Edit"449 permission="launchpad.Edit"
449 set_attributes="bug_reporting_guidelines"/>450 set_attributes="
451 bug_reported_acknowledgement
452 bug_reporting_guidelines"/>
450 </class>453 </class>
451 <adapter454 <adapter
452 for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"455 for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
@@ -1088,7 +1091,8 @@
1088 interface="lp.registry.interfaces.product.IProductEditRestricted"/>1091 interface="lp.registry.interfaces.product.IProductEditRestricted"/>
1089 <require1092 <require
1090 permission="launchpad.Edit"1093 permission="launchpad.Edit"
1091 set_attributes="bug_reporting_guidelines bugtracker1094 set_attributes="bug_reporting_guidelines
1095 bug_reported_acknowledgement bugtracker
1092 commercial_subscription description1096 commercial_subscription description
1093 development_focus displayname downloadurl1097 development_focus displayname downloadurl
1094 driver enable_bug_expiration1098 driver enable_bug_expiration
@@ -1407,7 +1411,8 @@
1407 displayname title summary description driver1411 displayname title summary description driver
1408 members owner security_contact mirror_admin homepage_content1412 members owner security_contact mirror_admin homepage_content
1409 icon logo mugshot enable_bug_expiration1413 icon logo mugshot enable_bug_expiration
1410 bug_reporting_guidelines official_blueprints official_malone1414 bug_reporting_guidelines bug_reported_acknowledgement
1415 official_blueprints official_malone
1411 official_rosetta official_answers official_bug_tags"/>1416 official_rosetta official_answers official_bug_tags"/>
1412 <require1417 <require
1413 permission="launchpad.TranslationsAdmin"1418 permission="launchpad.TranslationsAdmin"
14141419
=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
--- lib/lp/registry/interfaces/projectgroup.py 2010-04-19 08:30:06 +0000
+++ lib/lp/registry/interfaces/projectgroup.py 2010-05-24 14:27:31 +0000
@@ -261,6 +261,16 @@
261 required=False,261 required=False,
262 max_length=50000))262 max_length=50000))
263263
264 bug_reported_acknowledgement = exported(
265 Text(
266 title=(
267 u"After reporting a bug, I can expect the following."),
268 description=(
269 u"This message of acknowledgement will be displayed "
270 "to anyone after reporting a bug."),
271 required=False,
272 max_length=50000))
273
264 def getProduct(name):274 def getProduct(name):
265 """Get a product with name `name`."""275 """Get a product with name `name`."""
266276
267277
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-05-07 20:09:03 +0000
+++ lib/lp/registry/model/distribution.py 2010-05-24 14:27:31 +0000
@@ -156,6 +156,7 @@
156 notNull=False,156 notNull=False,
157 default=None)157 default=None)
158 bug_reporting_guidelines = StringCol(default=None)158 bug_reporting_guidelines = StringCol(default=None)
159 bug_reported_acknowledgement = StringCol(default=None)
159 security_contact = ForeignKey(160 security_contact = ForeignKey(
160 dbName='security_contact', foreignKey='Person',161 dbName='security_contact', foreignKey='Person',
161 storm_validator=validate_public_person, notNull=False,162 storm_validator=validate_public_person, notNull=False,
162163
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-05-12 23:23:19 +0000
+++ lib/lp/registry/model/distroseries.py 2010-05-24 14:27:31 +0000
@@ -505,6 +505,11 @@
505 """See `IBugTarget`."""505 """See `IBugTarget`."""
506 return self.distribution.bug_reporting_guidelines506 return self.distribution.bug_reporting_guidelines
507507
508 @property
509 def bug_reported_acknowledgement(self):
510 """See `IBugTarget`."""
511 return self.distribution.bug_reported_acknowledgement
512
508 def _getMilestoneCondition(self):513 def _getMilestoneCondition(self):
509 """See `HasMilestonesMixin`."""514 """See `HasMilestonesMixin`."""
510 return (Milestone.distroseries == self)515 return (Milestone.distroseries == self)
511516
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-04-27 13:57:18 +0000
+++ lib/lp/registry/model/product.py 2010-05-24 14:27:31 +0000
@@ -288,6 +288,7 @@
288 foreignKey="ProductSeries", dbName="development_focus", notNull=False,288 foreignKey="ProductSeries", dbName="development_focus", notNull=False,
289 default=None)289 default=None)
290 bug_reporting_guidelines = StringCol(default=None)290 bug_reporting_guidelines = StringCol(default=None)
291 bug_reported_acknowledgement = StringCol(default=None)
291 _cached_licenses = None292 _cached_licenses = None
292293
293 def _validate_active(self, attr, value):294 def _validate_active(self, attr, value):
294295
=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2010-03-24 02:53:42 +0000
+++ lib/lp/registry/model/productseries.py 2010-05-24 14:27:31 +0000
@@ -181,6 +181,11 @@
181 return self.product.bug_reporting_guidelines181 return self.product.bug_reporting_guidelines
182182
183 @property183 @property
184 def bug_reported_acknowledgement(self):
185 """See `IBugTarget`."""
186 return self.product.bug_reported_acknowledgement
187
188 @property
184 def sourcepackages(self):189 def sourcepackages(self):
185 """See IProductSeries"""190 """See IProductSeries"""
186 from lp.registry.model.sourcepackage import SourcePackage191 from lp.registry.model.sourcepackage import SourcePackage
187192
=== modified file 'lib/lp/registry/model/projectgroup.py'
--- lib/lp/registry/model/projectgroup.py 2010-04-16 15:06:55 +0000
+++ lib/lp/registry/model/projectgroup.py 2010-05-24 14:27:31 +0000
@@ -123,6 +123,7 @@
123 foreignKey="BugTracker", dbName="bugtracker", notNull=False,123 foreignKey="BugTracker", dbName="bugtracker", notNull=False,
124 default=None)124 default=None)
125 bug_reporting_guidelines = StringCol(default=None)125 bug_reporting_guidelines = StringCol(default=None)
126 bug_reported_acknowledgement = StringCol(default=None)
126 max_bug_heat = Int()127 max_bug_heat = Int()
127128
128 # convenient joins129 # convenient joins
129130
=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py 2010-04-14 18:31:51 +0000
+++ lib/lp/registry/model/sourcepackage.py 2010-05-24 14:27:31 +0000
@@ -427,6 +427,11 @@
427 """See `IBugTarget`."""427 """See `IBugTarget`."""
428 return self.distribution.bug_reporting_guidelines428 return self.distribution.bug_reporting_guidelines
429429
430 @property
431 def bug_reported_acknowledgement(self):
432 """See `IBugTarget`."""
433 return self.distribution.bug_reported_acknowledgement
434
430 def _customizeSearchParams(self, search_params):435 def _customizeSearchParams(self, search_params):
431 """Customize `search_params` for this source package."""436 """Customize `search_params` for this source package."""
432 search_params.setSourcePackage(self)437 search_params.setSourcePackage(self)

Subscribers

People subscribed via source and target branches

to status/vote changes: