launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15116
[Merge] lp:~stevenk/launchpad/destroy-private-projects-feature-flags into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/destroy-private-projects-feature-flags into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/destroy-private-projects-feature-flags/+merge/147022
Destroy the three private project feature flags.
--
https://code.launchpad.net/~stevenk/launchpad/destroy-private-projects-feature-flags/+merge/147022
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/destroy-private-projects-feature-flags into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/specification.py'
--- lib/lp/blueprints/browser/specification.py 2013-01-30 05:31:20 +0000
+++ lib/lp/blueprints/browser/specification.py 2013-02-07 06:17:24 +0000
@@ -125,7 +125,6 @@
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.productseries import IProductSeries
from lp.services.config import config
-from lp.services.features import getFeatureFlag
from lp.services.fields import WorkItemsText
from lp.services.propertycache import cachedproperty
from lp.services.webapp import (
@@ -144,21 +143,12 @@
)
-INFORMATION_TYPE_FLAG = 'blueprints.information_type.enabled'
-
-
class INewSpecification(Interface):
"""A schema for a new specification."""
use_template(ISpecification, include=[
- 'name',
- 'title',
- 'specurl',
- 'summary',
- 'assignee',
- 'drafter',
- 'approver',
- ])
+ 'name', 'title', 'specurl', 'summary', 'assignee', 'drafter',
+ 'approver'])
definition_status = Choice(
title=_('Definition Status'),
@@ -225,8 +215,6 @@
Does nothing if the user cannot select different information types or
the feature flag is not enabled.
"""
- if not getFeatureFlag(INFORMATION_TYPE_FLAG):
- return fields
if len(self.info_types) < 2:
return fields
info_type_field = copy_field(ISpecification['information_type'],
@@ -318,10 +306,6 @@
def validate(self, data):
"""See `LaunchpadFormView`.`"""
super(NewSpecificationView, self).validate(data)
- self.validate_information_type(data)
-
- def validate_information_type(self, data):
- """Validate the information type is allowed for this context."""
information_type = data.get('information_type', None)
if information_type is None:
# We rely on the model to set the correct default value.
@@ -519,14 +503,11 @@
class SpecificationContextMenu(ContextMenu, SpecificationEditLinksMixin):
usedfor = ISpecification
- links = ['edit', 'people', 'status', 'priority',
- 'whiteboard', 'proposegoal', 'workitems',
- 'milestone', 'subscription',
- 'addsubscriber',
- 'linkbug', 'unlinkbug', 'linkbranch',
- 'adddependency', 'removedependency',
- 'dependencytree', 'linksprint', 'supersede',
- 'retarget', 'information_type']
+ links = ['edit', 'people', 'status', 'priority', 'whiteboard',
+ 'proposegoal', 'workitems', 'milestone', 'subscription',
+ 'addsubscriber', 'linkbug', 'unlinkbug', 'linkbranch',
+ 'adddependency', 'removedependency', 'dependencytree',
+ 'linksprint', 'supersede', 'retarget', 'information_type']
@enabled_with_permission('launchpad.Edit')
def milestone(self):
@@ -1537,16 +1518,13 @@
@action(_('Continue'), name='continue')
def continue_action(self, action, data):
- self.context.linkBranch(branch=data['branch'],
- registrant=self.user)
+ self.context.linkBranch(branch=data['branch'], registrant=self.user)
@property
def next_url(self):
return canonical_url(self.context)
- @property
- def cancel_url(self):
- return canonical_url(self.context)
+ cancel_url = next_url
class SpecificationSetView(AppFrontPageSearchView, HasSpecificationsView):
@@ -1600,8 +1578,7 @@
if starter is None:
return ''
date_formatter = DateTimeFormatterAPI(context.date_started)
- return "%s %s" % (
- format_link(starter), date_formatter.displaydate())
+ return "%s %s" % (format_link(starter), date_formatter.displaydate())
return render
@@ -1615,6 +1592,5 @@
if completer is None:
return ''
date_formatter = DateTimeFormatterAPI(context.date_completed)
- return "%s %s" % (
- format_link(completer), date_formatter.displaydate())
+ return "%s %s" % (format_link(completer), date_formatter.displaydate())
return render
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py 2013-01-31 05:34:42 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py 2013-02-07 06:17:24 +0000
@@ -27,7 +27,6 @@
from lp.app.enums import InformationType
from lp.app.interfaces.services import IService
from lp.blueprints.browser import specification
-from lp.blueprints.browser.specification import INFORMATION_TYPE_FLAG
from lp.blueprints.enums import SpecificationImplementationStatus
from lp.blueprints.interfaces.specification import (
ISpecification,
@@ -36,7 +35,6 @@
from lp.registry.enums import SpecificationSharingPolicy
from lp.registry.interfaces.person import PersonVisibility
from lp.registry.interfaces.product import IProductSeries
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.escaping import html_escape
from lp.services.webapp.interaction import ANONYMOUS
from lp.services.webapp.interfaces import BrowserNotificationLevel
@@ -219,12 +217,6 @@
self.assertIn(spec_name, view.contents)
-def set_blueprint_information_type(test_case, enabled):
- value = 'true' if enabled else ''
- fixture = FeatureFixture({INFORMATION_TYPE_FLAG: value})
- test_case.useFixture(fixture)
-
-
class TestSpecificationSet(BrowserTestCase):
layer = DatabaseFunctionalLayer
@@ -268,10 +260,6 @@
portlet_tag = soupmatchers.Tag(
'info-type-portlet', True, attrs=dict(id='information-type-summary'))
- def setUp(self):
- super(TestSpecificationInformationType, self).setUp()
- set_blueprint_information_type(self, True)
-
def assertBrowserMatches(self, matcher):
browser = self.getViewBrowser(self.factory.makeSpecification())
self.assertThat(browser.contents, matcher)
@@ -279,11 +267,6 @@
def test_has_privacy_portlet(self):
self.assertBrowserMatches(soupmatchers.HTMLContains(self.portlet_tag))
- def test_privacy_portlet_requires_flag(self):
- set_blueprint_information_type(self, False)
- self.assertBrowserMatches(
- Not(soupmatchers.HTMLContains(self.portlet_tag)))
-
def test_has_privacy_banner(self):
owner = self.factory.makePerson()
policy = SpecificationSharingPolicy.PUBLIC_OR_PROPRIETARY
@@ -433,7 +416,6 @@
def test_allowed_info_type_validated(self):
"""information_type must be validated against context"""
- set_blueprint_information_type(self, True)
context = getUtility(ISpecificationSet)
product = self.factory.makeProduct()
form = self._create_form_data(product.name)
@@ -454,7 +436,6 @@
def test_allowed_info_type_validated(self):
"""information_type must be validated against context"""
- set_blueprint_information_type(self, True)
sprint = self.factory.makeSprint()
product = self.factory.makeProduct(owner=sprint.owner)
form = self._create_form_data(product.name)
@@ -474,7 +455,6 @@
def test_allowed_info_type_validated(self):
"""information_type must be validated against context"""
- set_blueprint_information_type(self, True)
project = self.factory.makeProject()
product = self.factory.makeProduct(project=project)
form = self._create_form_data(product.name)
@@ -522,7 +502,6 @@
def setUp(self):
super(TestNewSpecificationInformationType, self).setUp()
- set_blueprint_information_type(self, True)
it_field = soupmatchers.Tag(
'it-field', True, attrs=dict(name='field.information_type'))
self.match_it = soupmatchers.HTMLContains(it_field)
@@ -532,25 +511,12 @@
browser = self.getUserBrowser(NEW_SPEC_FROM_ROOT_URL)
self.assertThat(browser.contents, self.match_it)
- def test_from_root_no_flag(self):
- """Information_type is excluded with no flag."""
- set_blueprint_information_type(self, False)
- browser = self.getUserBrowser(NEW_SPEC_FROM_ROOT_URL)
- self.assertThat(browser.contents, Not(self.match_it))
-
def test_from_sprint(self):
"""Information_type is included creating from a sprint."""
sprint = self.factory.makeSprint()
browser = self.getViewBrowser(sprint, view_name='+addspec')
self.assertThat(browser.contents, self.match_it)
- def test_from_sprint_no_flag(self):
- """Information_type is excluded with no flag."""
- set_blueprint_information_type(self, False)
- sprint = self.factory.makeSprint()
- browser = self.getViewBrowser(sprint, view_name='+addspec')
- self.assertThat(browser.contents, Not(self.match_it))
-
def submitSpec(self, browser):
"""Submit a Specification via a browser."""
name = self.factory.getUniqueString()
@@ -592,13 +558,6 @@
SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY)
self.assertEqual(InformationType.EMBARGOED, spec.information_type)
- def test_from_product_no_flag(self):
- """information_type is excluded with no flag."""
- set_blueprint_information_type(self, False)
- product = self.factory.makeProduct()
- browser = self.getViewBrowser(product, view_name='+addspec')
- self.assertThat(browser.contents, Not(self.match_it))
-
def test_from_productseries(self):
"""Information_type is included creating from productseries."""
policy = SpecificationSharingPolicy.PUBLIC_OR_PROPRIETARY
@@ -608,13 +567,6 @@
browser = self.getViewBrowser(series, view_name='+addspec')
self.assertThat(browser.contents, self.match_it)
- def test_from_productseries_no_flag(self):
- """information_type is excluded with no flag."""
- set_blueprint_information_type(self, False)
- series = self.factory.makeProductSeries()
- browser = self.getViewBrowser(series, view_name='+addspec')
- self.assertThat(browser.contents, Not(self.match_it))
-
def test_from_distribution(self):
"""information_type is excluded creating from distro."""
distro = self.factory.makeDistribution()
@@ -633,7 +585,6 @@
layer = DatabaseFunctionalLayer
def _setUp(self):
- set_blueprint_information_type(self, True)
it_field = soupmatchers.Tag(
'it-field', True, attrs=dict(name='field.information_type'))
self.match_it = soupmatchers.HTMLContains(it_field)
=== modified file 'lib/lp/blueprints/templates/specification-index.pt'
--- lib/lp/blueprints/templates/specification-index.pt 2012-10-15 16:01:38 +0000
+++ lib/lp/blueprints/templates/specification-index.pt 2013-02-07 06:17:24 +0000
@@ -386,7 +386,7 @@
<tal:side metal:fill-slot="side">
<tal:menu replace="structure context/@@+global-actions" />
- <tal:privacy replace="structure context/@@+portlet-privacy" condition="features/blueprints.information_type.enabled" />
+ <tal:privacy replace="structure context/@@+portlet-privacy" />
<div tal:replace="structure context/@@+portlet-subscribers" />
</tal:side>
</body>
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2012-12-18 16:41:18 +0000
+++ lib/lp/registry/browser/pillar.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Common views for objects that implement `IPillar`."""
@@ -56,7 +56,6 @@
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.registry.model.pillar import PillarPerson
from lp.services.config import config
-from lp.services.features import getFeatureFlag
from lp.services.propertycache import cachedproperty
from lp.services.webapp.authorization import check_permission
from lp.services.webapp.batching import (
@@ -294,10 +293,8 @@
@property
def specification_sharing_policies(self):
- if getFeatureFlag('blueprints.information_type.enabled'):
- return self._getSharingService().getSpecificationSharingPolicies(
- self.context)
- return None
+ return self._getSharingService().getSpecificationSharingPolicies(
+ self.context)
@property
def sharing_permissions(self):
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2012-11-28 21:26:06 +0000
+++ lib/lp/registry/browser/product.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Browser views for products."""
@@ -174,7 +174,6 @@
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
from lp.services.config import config
from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.features import getFeatureFlag
from lp.services.feeds.browser import FeedsMixin
from lp.services.fields import (
PillarAliases,
@@ -209,7 +208,6 @@
OR = ' OR '
SPACE = ' '
-PRIVATE_PROJECTS_FLAG = 'disclosure.private_projects.enabled'
class ProductNavigation(
@@ -1397,8 +1395,7 @@
custom_widget('licenses', LicenseWidget)
custom_widget('license_info', GhostWidget)
custom_widget(
- 'information_type',
- LaunchpadRadioWidgetWithDescription,
+ 'information_type', LaunchpadRadioWidgetWithDescription,
vocabulary=InformationTypeVocabulary(
types=PUBLIC_PROPRIETARY_INFORMATION_TYPES))
@@ -1424,19 +1421,10 @@
# the form is rendered during LaunchpadFormView's initialize()
# when an action is invoked.
cache = IJSONRequestCache(self.request)
- json_dump_information_types(cache,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES)
+ json_dump_information_types(
+ cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES)
super(ProductEditView, self).initialize()
- def setUpFields(self):
- """See `LaunchpadFormView`."""
- super(ProductEditView, self).setUpFields()
-
- private_projects_flag = 'disclosure.private_projects.enabled'
- private_projects = bool(getFeatureFlag(private_projects_flag))
- if not private_projects:
- self.form_fields = self.form_fields.omit('information_type')
-
def validate(self, data):
"""Validate 'licenses' and 'license_info'.
@@ -1447,10 +1435,11 @@
or "Other/Open Source" is checked.
"""
super(ProductEditView, self).validate(data)
- info_type = data.get('information_type')
- if info_type is not None:
- errors = [str(e) for e in
- self.context.checkInformationType(info_type)]
+ information_type = data.get('information_type')
+ if information_type:
+ errors = [
+ str(e) for e in self.context.checkInformationType(
+ information_type)]
if len(errors) > 0:
self.setFieldError('information_type', ' '.join(errors))
@@ -1881,9 +1870,7 @@
def setUpFields(self):
"""See `LaunchpadFormView`."""
super(ProjectAddStepOne, self).setUpFields()
- self.form_fields = (
- self.form_fields +
- create_source_package_fields())
+ self.form_fields = (self.form_fields + create_source_package_fields())
def setUpWidgets(self):
"""See `LaunchpadFormView`."""
@@ -1925,8 +1912,7 @@
_field_names = ['displayname', 'name', 'title', 'summary', 'description',
'homepageurl', 'information_type', 'licenses',
- 'license_info', 'driver', 'bug_supervisor', 'owner',
- ]
+ 'license_info', 'driver', 'bug_supervisor', 'owner']
schema = IProduct
step_name = 'projectaddstep2'
template = ViewPageTemplateFile('../templates/product-new.pt')
@@ -1962,8 +1948,8 @@
# the form is rendered during LaunchpadFormView's initialize()
# when an action is invoked.
cache = IJSONRequestCache(self.request)
- json_dump_information_types(cache,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES)
+ json_dump_information_types(
+ cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES)
super(ProjectAddStepTwo, self).initialize()
@property
@@ -1972,8 +1958,7 @@
return u'Complete Registration'
else:
return u'Complete registration and link to %s package' % (
- self.source_package_name.name,
- )
+ self.source_package_name.name)
@property
def _return_url(self):
@@ -2003,8 +1988,7 @@
@property
def enable_information_type(self):
- private_projects = bool(getFeatureFlag(PRIVATE_PROJECTS_FLAG))
- return private_projects and not self.source_package_name
+ return not self.source_package_name
def setUpFields(self):
"""See `LaunchpadFormView`."""
@@ -2013,14 +1997,13 @@
hidden_fields = self.form_fields.select(*hidden_names)
if not self.enable_information_type:
- hidden_names.extend([
- 'information_type', 'bug_supervisor', 'driver'])
+ hidden_names.extend(
+ ['information_type', 'bug_supervisor', 'driver'])
visible_fields = self.form_fields.omit(*hidden_names)
- self.form_fields = (visible_fields +
- self._createDisclaimMaintainerField() +
- create_source_package_fields() +
- hidden_fields)
+ self.form_fields = (
+ visible_fields + self._createDisclaimMaintainerField() +
+ create_source_package_fields() + hidden_fields)
def _createDisclaimMaintainerField(self):
"""Return a Bool field for disclaiming maintainer.
@@ -2048,8 +2031,8 @@
self.widgets['name'].read_only = True
# The "hint" is really more of an explanation at this point, but the
# phrasing is different.
- self.widgets['name'].hint = ('When published, '
- "this will be the project's URL.")
+ self.widgets['name'].hint = (
+ "When published, this will be the project's URL.")
self.widgets['displayname'].visible = False
self.widgets['source_package_name'].visible = False
self.widgets['distroseries'].visible = False
@@ -2100,14 +2083,13 @@
"""
# XXX BarryWarsaw 16-Apr-2009 do we need batching and should we return
# more than 7 hits?
- pillar_set = getUtility(IPillarNameSet)
- return pillar_set.search(self._search_string, 7)
+ return getUtility(IPillarNameSet).search(self._search_string, 7)
@cachedproperty
def search_results_count(self):
"""Return the count of matching `IPillar`s."""
- pillar_set = getUtility(IPillarNameSet)
- return pillar_set.count_search_matches(self._search_string)
+ return getUtility(IPillarNameSet).count_search_matches(
+ self._search_string)
# StepView requires that its validate() method not be overridden, so make
# sure this calls the right method. validateStep() will call the licence
@@ -2130,8 +2112,7 @@
for required_field in ('bug_supervisor', 'driver'):
if data.get(required_field) is None:
self.setFieldError(
- required_field,
- 'Select a user or team.')
+ required_field, 'Select a user or team.')
@property
def label(self):
@@ -2194,7 +2175,6 @@
"""The controlling view for product/+new."""
page_title = ProjectAddStepOne.page_title
- related_features = (PRIVATE_PROJECTS_FLAG,)
total_steps = 2
@property
=== modified file 'lib/lp/registry/browser/tests/project-add-views.txt'
--- lib/lp/registry/browser/tests/project-add-views.txt 2012-07-30 20:02:26 +0000
+++ lib/lp/registry/browser/tests/project-add-views.txt 2013-02-07 06:17:24 +0000
@@ -130,6 +130,7 @@
... print error
You must select at least one licence. If you select Other/Proprietary
or Other/OpenSource you must include a description of the licence.
+ ...
When an open source licence is selected, the project is created.
@@ -144,6 +145,8 @@
... 'field.licenses': ['PYTHON'],
... 'field.license_info': '',
... 'field.owner': registrant.name,
+ ... 'field.driver': registrant.name,
+ ... 'field.bug_supervisor': registrant.name,
... 'field.__visited_steps__': '%s|%s' % (
... ProjectAddStepOne.step_name, ProjectAddStepTwo.step_name),
... 'field.actions.continue': 'Continue',
=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-12-20 14:53:10 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd. This software is licensed under the
+# Copyright 2012-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test views that manage sharing."""
@@ -29,7 +29,6 @@
from lp.registry.model.pillar import PillarPerson
from lp.services.config import config
from lp.services.database.lpstorm import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.interfaces import StormRangeFactoryError
from lp.services.webapp.publisher import canonical_url
from lp.testing import (
@@ -270,9 +269,8 @@
self.assertIsNotNone(cache.objects.get('branch_sharing_policies'))
self.assertIsNotNone(cache.objects.get('bug_sharing_policies'))
self.assertIsNotNone(cache.objects.get('sharing_permissions'))
- # Ensure we don't set specification_sharing_policies without the
- # feature flag enabled.
- self.assertIsNone(cache.objects.get('specification_sharing_policies'))
+ self.assertIsNotNone(
+ cache.objects.get('specification_sharing_policies'))
batch_size = config.launchpad.default_batch_size
apgfs = getUtility(IAccessPolicyGrantFlatSource)
grantees = apgfs.findGranteePermissionsByPolicy(
@@ -282,18 +280,6 @@
self.assertContentEqual(
grantee_data, cache.objects.get('grantee_data'))
- def test_view_date_model_adds_specification(self):
- # This test can move up to the above test when not feature flagged,
- # but for now, ensure specification_sharing_policies is added to
- # the cache if the flag is set.
- feature_flag = {
- 'blueprints.information_type.enabled': 'on'}
- with FeatureFixture(feature_flag):
- view = create_initialized_view(self.pillar, name='+sharing')
- cache = IJSONRequestCache(view.request)
- self.assertIsNotNone(
- cache.objects.get('specification_sharing_policies'))
-
def test_view_batch_data(self):
# Test the expected batching data is in the json request cache.
view = create_initialized_view(self.pillar, name='+sharing')
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2012-11-26 21:01:54 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for product views."""
@@ -28,7 +28,6 @@
ServiceUsage,
)
from lp.registry.browser.product import (
- PRIVATE_PROJECTS_FLAG,
ProjectAddStepOne,
ProjectAddStepTwo,
)
@@ -43,7 +42,6 @@
from lp.registry.model.product import Product
from lp.services.config import config
from lp.services.database.lpstorm import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.publisher import canonical_url
from lp.testing import (
BrowserTestCase,
@@ -151,7 +149,7 @@
form['field.licenses'] = License.OTHER_PROPRIETARY.title
form['field.license_info'] = 'Commercial Subscription'
else:
- form['field.information_type'] = 0
+ form['field.information_type'] = 'PUBLIC'
form['field.owner'] = ''
form['field.licenses'] = ['MIT']
form['field.license_info'] = ''
@@ -178,7 +176,6 @@
self.assertContentEqual(
team_membership_policy_data,
cache.objects['team_membership_policy_data'])
- self.assertIn(PRIVATE_PROJECTS_FLAG, cache.objects['related_features'])
def test_staging_message_is_not_demo(self):
view = create_initialized_view(self.product_set, '+new')
@@ -214,7 +211,8 @@
view.view.field_names)
self.assertEqual(
['displayname', 'name', 'title', 'summary', 'description',
- 'homepageurl', 'licenses', 'owner', 'disclaim_maintainer',
+ 'homepageurl', 'information_type', 'licenses', 'driver',
+ 'bug_supervisor', 'owner', 'disclaim_maintainer',
'source_package_name', 'distroseries', '__visited_steps__',
'license_info'],
[f.__name__ for f in view.view.form_fields])
@@ -266,36 +264,25 @@
form = make_product_form(action=2)
form['field.owner'] = ''
form['field.disclaim_maintainer'] = 'on'
+ form['field.information_type'] = 'PUBLIC'
view = create_initialized_view(self.product_set, '+new', form=form)
self.assertEqual(0, len(view.view.errors))
product = self.product_set.getByName('fnord')
self.assertEqual('registry', product.owner.name)
- def test_information_type_saved_new_product_default(self):
- # information_type should be PUBLIC by default for new projects.
- # if the private projects feature flag is not enabled.
- registrant = self.factory.makePerson()
- login_person(registrant)
- form = make_product_form(registrant, action=2, proprietary=True)
- view = create_initialized_view(self.product_set, '+new', form=form)
- self.assertEqual(0, len(view.view.errors))
- product = self.product_set.getByName('fnord')
- self.assertEqual(InformationType.PUBLIC, product.information_type)
-
def test_information_type_saved_new_product_updated(self):
# information_type will be updated if passed in via form data,
# if the private projects feature flag is enabled.
- with FeatureFixture({u'disclosure.private_projects.enabled': u'on'}):
- registrant = self.factory.makePerson()
- login_person(registrant)
- form = make_product_form(registrant, action=2, proprietary=True)
- form['field.maintainer'] = registrant.name
- view = create_initialized_view(
- self.product_set, '+new', form=form)
- self.assertEqual(0, len(view.view.errors))
- product = self.product_set.getByName('fnord')
- self.assertEqual(
- InformationType.PROPRIETARY, product.information_type)
+ registrant = self.factory.makePerson()
+ login_person(registrant)
+ form = make_product_form(registrant, action=2, proprietary=True)
+ form['field.maintainer'] = registrant.name
+ view = create_initialized_view(
+ self.product_set, '+new', form=form)
+ self.assertEqual(0, len(view.view.errors))
+ product = self.product_set.getByName('fnord')
+ self.assertEqual(
+ InformationType.PROPRIETARY, product.information_type)
class TestProductView(BrowserTestCase):
@@ -488,37 +475,30 @@
def test_limited_information_types_allowed(self):
"""Products can only be PUBLIC_PROPRIETARY_INFORMATION_TYPES"""
product = self.factory.makeProduct()
- with FeatureFixture({u'disclosure.private_projects.enabled': u'on'}):
- login_person(product.owner)
- view = create_initialized_view(
- product,
- '+edit',
- principal=product.owner)
- vocabulary = view.widgets['information_type'].vocabulary
- info_types = [t.name for t in vocabulary]
- expected = ['PUBLIC', 'PROPRIETARY', 'EMBARGOED']
- self.assertEqual(expected, info_types)
+ login_person(product.owner)
+ view = create_initialized_view(
+ product, '+edit', principal=product.owner)
+ vocabulary = view.widgets['information_type'].vocabulary
+ info_types = [t.name for t in vocabulary]
+ expected = ['PUBLIC', 'PROPRIETARY', 'EMBARGOED']
+ self.assertEqual(expected, info_types)
def test_change_information_type_proprietary(self):
product = self.factory.makeProduct(name='fnord')
- with FeatureFixture({u'disclosure.private_projects.enabled': u'on'}):
- login_person(product.owner)
- form = self._make_product_edit_form(product, proprietary=True)
- view = create_initialized_view(product, '+edit', form=form)
- self.assertEqual(0, len(view.errors))
+ login_person(product.owner)
+ form = self._make_product_edit_form(product, proprietary=True)
+ view = create_initialized_view(product, '+edit', form=form)
+ self.assertEqual(0, len(view.errors))
- product_set = getUtility(IProductSet)
- updated_product = product_set.getByName('fnord')
- self.assertEqual(
- InformationType.PROPRIETARY, updated_product.information_type)
- # A complimentary commercial subscription is auto generated for
- # the product when the information type is changed.
- self.assertIsNotNone(updated_product.commercial_subscription)
+ updated_product = getUtility(IProductSet).getByName('fnord')
+ self.assertEqual(
+ InformationType.PROPRIETARY, updated_product.information_type)
+ # A complimentary commercial subscription is auto generated for
+ # the product when the information type is changed.
+ self.assertIsNotNone(updated_product.commercial_subscription)
def test_change_information_type_proprietary_packaged(self):
# It should be an error to make a Product private if it is packaged.
- self.useFixture(FeatureFixture(
- {u'disclosure.private_projects.enabled': u'on'}))
product = self.factory.makeProduct()
sourcepackage = self.factory.makeSourcePackage()
sourcepackage.setPackaging(product.development_focus, product.owner)
@@ -537,8 +517,6 @@
product = self.factory.makeProduct()
self.factory.makeBranch(product=product)
self.factory.makeSpecification(product=product)
- self.useFixture(FeatureFixture(
- {u'disclosure.private_projects.enabled': u'on'}))
browser = self.getViewBrowser(product, '+edit', user=product.owner)
info_type = browser.getControl(name='field.information_type')
info_type.value = ['PROPRIETARY']
@@ -552,20 +530,16 @@
def test_change_information_type_public(self):
owner = self.factory.makePerson(name='pting')
product = self.factory.makeProduct(
- name='fnord',
- information_type=InformationType.PROPRIETARY,
- owner=owner,
- )
- with FeatureFixture({u'disclosure.private_projects.enabled': u'on'}):
- login_person(owner)
- form = self._make_product_edit_form(product)
- view = create_initialized_view(product, '+edit', form=form)
- self.assertEqual(0, len(view.errors))
+ name='fnord', information_type=InformationType.PROPRIETARY,
+ owner=owner)
+ login_person(owner)
+ form = self._make_product_edit_form(product)
+ view = create_initialized_view(product, '+edit', form=form)
+ self.assertEqual(0, len(view.errors))
- product_set = getUtility(IProductSet)
- updated_product = product_set.getByName('fnord')
- self.assertEqual(
- InformationType.PUBLIC, updated_product.information_type)
+ updated_product = getUtility(IProductSet).getByName('fnord')
+ self.assertEqual(
+ InformationType.PUBLIC, updated_product.information_type)
class ProductSetReviewLicensesViewTestCase(TestCaseWithFactory):
=== modified file 'lib/lp/registry/browser/tests/test_projectgroup.py'
--- lib/lp/registry/browser/tests/test_projectgroup.py 2012-11-20 20:53:20 +0000
+++ lib/lp/registry/browser/tests/test_projectgroup.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for project group views."""
@@ -21,7 +21,6 @@
)
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.product import IProductSet
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp import canonical_url
from lp.services.webapp.interfaces import ILaunchBag
from lp.testing import (
@@ -102,8 +101,6 @@
def test_mixed_product_projectgroup_milestone(self):
# If a milestone is mixed between public and proprietary products,
# only the public is shown to people without access.
- self.useFixture(
- FeatureFixture({u'disclosure.private_projects.enabled': u'on'}))
owner = self.factory.makePerson()
teammember = self.factory.makePerson()
owning_team = self.factory.makeTeam(owner=owner,
@@ -205,8 +202,6 @@
def test_information_type(self):
# Information type controls are provided when creating a project via a
# project group.
- self.useFixture(
- FeatureFixture({u'disclosure.private_projects.enabled': u'on'}))
form = make_product_form(action=1)
project = self.factory.makeProject()
with person_logged_in(project.owner):
@@ -217,8 +212,6 @@
def test_information_type_saved(self):
# Setting information_type to PROPRIETARY via form actually works.
- self.useFixture(
- FeatureFixture({u'disclosure.private_projects.enabled': u'on'}))
project = self.factory.makeProject()
form = make_product_form(project.owner, action=2, proprietary=True)
with person_logged_in(project.owner):
=== modified file 'lib/lp/registry/browser/tests/test_sourcepackage_views.py'
--- lib/lp/registry/browser/tests/test_sourcepackage_views.py 2012-11-12 22:27:55 +0000
+++ lib/lp/registry/browser/tests/test_sourcepackage_views.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for SourcePackage view code."""
@@ -30,7 +30,6 @@
IDistroSeriesSet,
)
from lp.registry.interfaces.sourcepackage import ISourcePackage
-from lp.services.features.testing import FeatureFixture
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
BrowserTestCase,
@@ -165,8 +164,6 @@
def test_register_upstream_forbids_proprietary(self):
# Cannot specify information_type if registering for sourcepackage.
- self.useFixture(FeatureFixture({'disclosure.private_projects.enabled':
- 'on'}))
sourcepackage = self.factory.makeSourcePackage()
browser = self.getViewBrowser(sourcepackage)
browser.getControl("Register the upstream project").click()
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2013-01-22 05:07:31 +0000
+++ lib/lp/registry/model/product.py 2013-02-07 06:17:24 +0000
@@ -200,7 +200,6 @@
SQLBase,
sqlvalues,
)
-from lp.services.features import getFeatureFlag
from lp.services.propertycache import (
cachedproperty,
get_property_cache,
@@ -1562,8 +1561,6 @@
def userCanView(self, user):
"""See `IProductPublic`."""
- if getFeatureFlag('disclosure.private_project.traversal_override'):
- return True
if self.information_type in PUBLIC_INFORMATION_TYPES:
return True
if user is None:
=== modified file 'lib/lp/registry/tests/test_product.py'
--- lib/lp/registry/tests/test_product.py 2013-01-09 04:53:17 +0000
+++ lib/lp/registry/tests/test_product.py 2013-02-07 06:17:24 +0000
@@ -92,7 +92,6 @@
)
from lp.registry.model.productlicense import ProductLicense
from lp.services.database.lpstorm import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.authorization import check_permission
from lp.services.webapp.escaping import html_escape
from lp.testing import (
@@ -1196,28 +1195,6 @@
product.userCanView(user)
product.userCanView(IPersonRoles(user))
- def test_userCanView_override(self):
- # userCanView is overridden by the traversal override.
- product = self.factory.makeProduct(
- information_type=InformationType.PROPRIETARY)
- unprivileged = self.factory.makePerson()
- with person_logged_in(unprivileged):
- with FeatureFixture(
- {'disclosure.private_project.traversal_override': 'on'}):
- self.assertTrue(product.userCanView(unprivileged))
- self.assertFalse(product.userCanView(unprivileged))
-
- def test_anonymous_traversal_override(self):
- # The traversal override affects the permissions granted to anonymous
- # users.
- product = self.factory.makeProduct(
- information_type=InformationType.PROPRIETARY)
- with person_logged_in(None):
- with FeatureFixture(
- {'disclosure.private_project.traversal_override': 'on'}):
- self.assertTrue(check_permission('launchpad.View', product))
- self.assertFalse(check_permission('launchpad.View', product))
-
def test_information_type_prevents_pruning(self):
# Access policies for Product.information_type are not pruned.
owner = self.factory.makePerson()
=== modified file 'lib/lp/services/features/flags.py'
--- lib/lp/services/features/flags.py 2012-11-19 05:54:50 +0000
+++ lib/lp/services/features/flags.py 2013-02-07 06:17:24 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__all__ = [
@@ -57,12 +57,6 @@
'',
'',
''),
- ('blueprints.information_type.enabled',
- 'boolean',
- 'Enable UI for information_type on Blueprints.',
- 'Disable UI',
- 'Blueprint information_type UI',
- 'https://dev.launchpad.net/LEP/PrivateProjects'),
('bugs.affected_count_includes_dupes.disabled',
'boolean',
("Disable adding up affected users across all duplicate bugs."),
@@ -226,18 +220,6 @@
'',
'',
''),
- ('disclosure.private_projects.enabled',
- 'boolean',
- 'If true, enabled access to private project registration features.',
- 'disabled',
- 'Allow registering a non-public project.',
- 'http://blog.launchpad.net/general/private-projects-beta'),
- ('disclosure.private_project.traversal_override',
- 'boolean',
- 'If set, allow all users to traverse to private projects.',
- 'Traversal to private projects requires special access.',
- 'Override traveral checks.',
- 'https://dev.launchpad.net/LEP/PrivateProjects'),
])
# The set of all flag names that are documented.