← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Brian Murray has proposed merging lp:~brian-murray/launchpad/bug-supervisor-bug-expiry-submit into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


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
-- 
https://code.launchpad.net/~brian-murray/launchpad/bug-supervisor-bug-expiry-submit/+merge/39900
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/bug-supervisor-bug-expiry-submit into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2010-10-21 20:16:18 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2010-11-02 21:54:56 +0000
@@ -199,8 +199,9 @@
 
     def validate(self, data):
         """Constrain bug expiration to Launchpad Bugs tracker."""
-        self.validateBugSupervisor(data)
-        self.validateSecurityContact(data)
+        if check_permission("launchpad.Edit", self.context):
+            self.validateBugSupervisor(data)
+            self.validateSecurityContact(data)
         # enable_bug_expiration is disabled by JavaScript when bugtracker
         # is not 'In Launchpad'. The constraint is enforced here in case the
         # JavaScript fails to activate or run. Note that the bugtracker
@@ -215,10 +216,11 @@
         # bug_supervisor and security_contactrequires a transition method,
         # so it must be handled separately and removed for the
         # updateContextFromData to work as expected.
-        self.changeBugSupervisor(data['bug_supervisor'])
-        del data['bug_supervisor']
-        self.changeSecurityContact(data['security_contact'])
-        del data['security_contact']
+        if check_permission("launchpad.Edit", self.context):
+            self.changeBugSupervisor(data['bug_supervisor'])
+            del data['bug_supervisor']
+            self.changeSecurityContact(data['security_contact'])
+            del data['security_contact']
         self.updateContextFromData(data)
 
 

=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_configure.py'
--- lib/lp/bugs/browser/tests/test_bugtarget_configure.py	2010-10-20 14:58:01 +0000
+++ lib/lp/bugs/browser/tests/test_bugtarget_configure.py	2010-11-02 21:54:56 +0000
@@ -168,3 +168,15 @@
         self.assertEqual([], view.errors)
         self.assertEqual(
             'new guidelines', self.product.bug_reporting_guidelines)
+
+    def test_bug_supervisor_can_edit(self):
+        logout()
+        login_person(self.bug_supervisor)
+        form = self._makeForm()
+        # Only the bug_reporting_guidelines are different.
+        form['field.bug_reporting_guidelines'] = 'new guidelines'
+        view = create_initialized_view(
+            self.product, name='+configure-bugtracker', form=form)
+        self.assertEqual([], view.errors)
+        self.assertEqual(
+            'new guidelines', self.product.bug_reporting_guidelines)

=== 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-02 21:54:56 +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')
     <BLANKLINE>
     Traceback (most recent call last):
     ...

=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2010-10-29 10:01:34 +0000
+++ lib/lp/registry/configure.zcml	2010-11-02 21:54:56 +0000
@@ -1125,16 +1125,12 @@
         <require
             permission="launchpad.Edit"
             set_attributes="
-                bug_reported_acknowledgement
-                bug_reporting_guidelines
-                bugtracker
                 commercial_subscription
                 description
                 development_focus
                 displayname
                 downloadurl
                 driver
-                enable_bug_expiration
                 freshmeatproject
                 homepage_content
                 homepageurl
@@ -1146,13 +1142,11 @@
                 official_answers
                 official_blueprints
                 official_codehosting
-                official_malone
                 owner
                 programminglang
                 project
                 redeemSubscriptionVoucher
                 releaseroot
-                remote_product
                 screenshotsurl
                 security_contact
                 sourceforgeproject
@@ -1161,7 +1155,15 @@
                 wikiurl"/>
         <require
             permission="launchpad.BugSupervisor"
-            set_attributes="official_bug_tags"/>
+            set_attributes="
+                bug_reported_acknowledgement
+                bug_reporting_guidelines
+                bugtracker
+                enable_bug_expiration
+                official_bug_tags
+                official_malone
+                remote_product
+                "/>
 
         <!-- mark 2006-04-10 I put "name" in the admin group because
                         with Bazaar now in place, lots of people can have personal