← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/private_bugs-init-932721 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/private_bugs-init-932721 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #932721 in Launchpad itself: "project private bugs field not initialised on edit views"
  https://bugs.launchpad.net/launchpad/+bug/932721

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/private_bugs-init-932721/+merge/93199

When copy_field() is used to grab the Project private_bugs field, the render_context attribute is not set and so the field does not get set to the project's private_bugs value when a form is opened. The render_context value is explicitly set to true.

I added a couple of lines to a doc test to verify the fix. There's 3 forms but they use the same base class so we just need to check the one type.
-- 
https://code.launchpad.net/~wallyworld/launchpad/private_bugs-init-932721/+merge/93199
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/private_bugs-init-932721 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py	2012-02-14 07:06:37 +0000
+++ lib/lp/registry/browser/product.py	2012-02-15 13:29:20 +0000
@@ -1541,7 +1541,7 @@
         super(ProductPrivateBugsMixin, self).setUpFields()
         self.form_fields = self.form_fields.omit('private_bugs')
         private_bugs = copy_field(IProduct['private_bugs'], readonly=False)
-        self.form_fields += form.Fields(private_bugs)
+        self.form_fields += form.Fields(private_bugs, render_context=True)
 
     def validate(self, data):
         super(ProductPrivateBugsMixin, self).validate(data)

=== modified file 'lib/lp/registry/stories/product/xx-product-with-private-defaults.txt'
--- lib/lp/registry/stories/product/xx-product-with-private-defaults.txt	2012-02-09 02:47:38 +0000
+++ lib/lp/registry/stories/product/xx-product-with-private-defaults.txt	2012-02-15 13:29:20 +0000
@@ -18,7 +18,9 @@
     >>> admin_browser.open("http://launchpad.dev/redfish/+admin";)
     >>> admin_browser.getControl(name="field.private_bugs").value = True
     >>> admin_browser.getControl("Change").click()
-
+    >>> admin_browser.open("http://launchpad.dev/redfish/+admin";)
+    >>> admin_browser.getControl(name="field.private_bugs").value
+    True
 
 Filing a new bug
 ----------------


Follow ups