Merge lp:~brian-murray/launchpad/bug-supervisor-bug-expiry-submit into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Brian Murray
Approved revision: no longer in the source branch.
Merged at revision: 11861
Proposed branch: lp:~brian-murray/launchpad/bug-supervisor-bug-expiry-submit
Merge into: lp:launchpad
Diff against target: 116 lines (+30/-14)
4 files modified
lib/lp/bugs/browser/bugtarget.py (+8/-6)
lib/lp/bugs/browser/tests/test_bugtarget_configure.py (+12/-0)
lib/lp/bugs/stories/webservice/xx-bug-target.txt (+1/-1)
lib/lp/registry/configure.zcml (+9/-7)
To merge this branch: bzr merge lp:~brian-murray/launchpad/bug-supervisor-bug-expiry-submit
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+39900@code.launchpad.net

Commit message

Allow bug supervisors to submit changes regarding bug tracker configuration for their project.

Description of the change

This branch is a follow-up branch to the branch in the merge-proposal at https://code.launchpad.net/~brian-murray/launchpad/bug-supervisor-bug-expiry/+merge/38958. In that branch I was trying to allow the bug-supervisor of a product to configure parts of the bug tracker for their product at +configure-bugtracker. However, the bug supervisor can't actually submit the changes. This branch resolves that issue.

I've added a new test for editing the bugtracker to test_bugtarget_configure.py.

bin/test -cvvt test_bugtarget_configure.py

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Brian,

This branch looks good. I have one minor comment below.

-Edwin

>=== modified file 'lib/lp/bugs/stories/webservice/xx-bug-target.txt'
>--- lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-10-15 14:26:57 +0000
>+++ lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-11-03 22:22:32 +0000
>@@ -36,7 +36,7 @@
> Content-Type: text/plain
> X-Lazr-Oopsid: OOPS-...
> <BLANKLINE>
>- (<Product at 0x...>, 'bug_reporting_guidelines', 'launchpad.Edit')
>+ (<Product at 0x...>, 'bug_reporting_guidelines', 'launchpad.BugSupervisor')

If you just get rid of "0x" it will no longer be over 78 characters.

> <BLANKLINE>
> Traceback (most recent call last):
> ...
>

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugtarget.py'
2--- lib/lp/bugs/browser/bugtarget.py 2010-10-21 20:16:18 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2010-11-03 23:14:51 +0000
4@@ -199,8 +199,9 @@
5
6 def validate(self, data):
7 """Constrain bug expiration to Launchpad Bugs tracker."""
8- self.validateBugSupervisor(data)
9- self.validateSecurityContact(data)
10+ if check_permission("launchpad.Edit", self.context):
11+ self.validateBugSupervisor(data)
12+ self.validateSecurityContact(data)
13 # enable_bug_expiration is disabled by JavaScript when bugtracker
14 # is not 'In Launchpad'. The constraint is enforced here in case the
15 # JavaScript fails to activate or run. Note that the bugtracker
16@@ -215,10 +216,11 @@
17 # bug_supervisor and security_contactrequires a transition method,
18 # so it must be handled separately and removed for the
19 # updateContextFromData to work as expected.
20- self.changeBugSupervisor(data['bug_supervisor'])
21- del data['bug_supervisor']
22- self.changeSecurityContact(data['security_contact'])
23- del data['security_contact']
24+ if check_permission("launchpad.Edit", self.context):
25+ self.changeBugSupervisor(data['bug_supervisor'])
26+ del data['bug_supervisor']
27+ self.changeSecurityContact(data['security_contact'])
28+ del data['security_contact']
29 self.updateContextFromData(data)
30
31
32
33=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_configure.py'
34--- lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-10-20 14:58:01 +0000
35+++ lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-11-03 23:14:51 +0000
36@@ -168,3 +168,15 @@
37 self.assertEqual([], view.errors)
38 self.assertEqual(
39 'new guidelines', self.product.bug_reporting_guidelines)
40+
41+ def test_bug_supervisor_can_edit(self):
42+ logout()
43+ login_person(self.bug_supervisor)
44+ form = self._makeForm()
45+ # Only the bug_reporting_guidelines are different.
46+ form['field.bug_reporting_guidelines'] = 'new guidelines'
47+ view = create_initialized_view(
48+ self.product, name='+configure-bugtracker', form=form)
49+ self.assertEqual([], view.errors)
50+ self.assertEqual(
51+ 'new guidelines', self.product.bug_reporting_guidelines)
52
53=== modified file 'lib/lp/bugs/stories/webservice/xx-bug-target.txt'
54--- lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-10-15 14:26:57 +0000
55+++ lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-11-03 23:14:51 +0000
56@@ -36,7 +36,7 @@
57 Content-Type: text/plain
58 X-Lazr-Oopsid: OOPS-...
59 <BLANKLINE>
60- (<Product at 0x...>, 'bug_reporting_guidelines', 'launchpad.Edit')
61+ (..., 'bug_reporting_guidelines', 'launchpad.BugSupervisor')
62 <BLANKLINE>
63 Traceback (most recent call last):
64 ...
65
66=== modified file 'lib/lp/registry/configure.zcml'
67--- lib/lp/registry/configure.zcml 2010-11-02 20:10:56 +0000
68+++ lib/lp/registry/configure.zcml 2010-11-03 23:14:51 +0000
69@@ -1125,16 +1125,12 @@
70 <require
71 permission="launchpad.Edit"
72 set_attributes="
73- bug_reported_acknowledgement
74- bug_reporting_guidelines
75- bugtracker
76 commercial_subscription
77 description
78 development_focus
79 displayname
80 downloadurl
81 driver
82- enable_bug_expiration
83 freshmeatproject
84 homepage_content
85 homepageurl
86@@ -1146,13 +1142,11 @@
87 official_answers
88 official_blueprints
89 official_codehosting
90- official_malone
91 owner
92 programminglang
93 project
94 redeemSubscriptionVoucher
95 releaseroot
96- remote_product
97 screenshotsurl
98 security_contact
99 sourceforgeproject
100@@ -1161,7 +1155,15 @@
101 wikiurl"/>
102 <require
103 permission="launchpad.BugSupervisor"
104- set_attributes="official_bug_tags"/>
105+ set_attributes="
106+ bug_reported_acknowledgement
107+ bug_reporting_guidelines
108+ bugtracker
109+ enable_bug_expiration
110+ official_bug_tags
111+ official_malone
112+ remote_product
113+ "/>
114
115 <!-- mark 2006-04-10 I put "name" in the admin group because
116 with Bazaar now in place, lots of people can have personal