launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11199
[Merge] lp:~wallyworld/launchpad/add-project-membership-policy-1039692 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/add-project-membership-policy-1039692 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1039692 in Launchpad itself: "Cannot set team membership policy when creating a team in the person picker"
https://bugs.launchpad.net/launchpad/+bug/1039692
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/add-project-membership-policy-1039692/+merge/120697
== Implementation ==
A trivial change. The view used when adding a product did not inherit from the mixin which adds the required membership data to the request cache.
== Tests ==
Add test to TestProductAddView to ensure request cache is populated.
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/registry/browser/pillar.py
lib/lp/registry/browser/product.py
lib/lp/registry/browser/tests/test_pro
--
https://code.launchpad.net/~wallyworld/launchpad/add-project-membership-policy-1039692/+merge/120697
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/add-project-membership-policy-1039692 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2012-08-16 03:58:39 +0000
+++ lib/lp/registry/browser/pillar.py 2012-08-22 05:00:29 +0000
@@ -266,6 +266,7 @@
def initialize(self):
# Insert close team membership policy data into the json cache.
# This data is used for the maintainer and driver pickers.
+ super(PillarViewMixin, self).initialize()
cache = IJSONRequestCache(self.request)
policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY]
team_membership_policy_data = vocabulary_to_choice_edit_items(
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2012-08-16 04:36:09 +0000
+++ lib/lp/registry/browser/product.py 2012-08-22 05:00:29 +0000
@@ -2214,7 +2214,7 @@
self.next_url = self._return_url
-class ProductAddView(MultiStepView):
+class ProductAddView(PillarViewMixin, MultiStepView):
"""The controlling view for product/+new."""
page_title = ProjectAddStepOne.page_title
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2012-08-13 21:04:17 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2012-08-22 05:00:29 +0000
@@ -108,6 +108,18 @@
'field.disclaim_maintainer': 'off',
}
+ def test_view_data_model(self):
+ # The view's json request cache contains the expected data.
+ view = create_initialized_view(self.product_set, '+new')
+ cache = IJSONRequestCache(view.request)
+ policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY]
+ team_membership_policy_data = vocabulary_to_choice_edit_items(
+ SimpleVocabulary.fromItems(policy_items),
+ value_fn=lambda item: item.name)
+ self.assertContentEqual(
+ team_membership_policy_data,
+ cache.objects['team_membership_policy_data'])
+
def test_staging_message_is_not_demo(self):
view = create_initialized_view(self.product_set, '+new')
message = find_tag_by_id(view.render(), 'staging-message')
Follow ups