launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00677
[Merge] lp:~bac/launchpad/progress-enums into lp:launchpad/devel
Brad Crittenden has proposed merging lp:~bac/launchpad/progress-enums into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
= Summary =
The IServiceUsage class provides <app>_usage values to determine where a
product utilizes those services. It provides more information than just
the official_ boolean did.
We need to start using them in presenting the configuration links and
the progress bar.
== Proposed fix ==
Change the view to use the IServiceUsage values.
== Pre-implementation notes ==
None
== Implementation details ==
As above.
This branch needs to land at the same time or after Jon's companion branch.
== Tests ==
bin/test -vvt pillar-views.txt
== Demo and Q/A ==
Go to a project on launchpad.dev and ensure the configuration and status
links are correct.
Note: Until work being done by Jon is completed the demo will show
everything as not configured.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/registry/browser/product.py
lib/lp/registry/configure.zcml
lib/lp/registry/interfaces/product.py
lib/lp/registry/browser/tests/pillar-views.txt
lib/lp/registry/model/product.py
./lib/lp/registry/interfaces/product.py
901: E301 expected 1 blank line, found 2
./lib/lp/registry/model/product.py
264: E301 expected 1 blank line, found 0
282: E301 expected 1 blank line, found 0
291: E301 expected 1 blank line, found 0
299: E301 expected 1 blank line, found 0
--
https://code.launchpad.net/~bac/launchpad/progress-enums/+merge/33156
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/progress-enums into lp:launchpad/devel.
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2010-08-19 03:26:03 +0000
+++ lib/lp/registry/browser/product.py 2010-08-19 21:20:59 +0000
@@ -69,6 +69,7 @@
from lazr.restful.interface import copy_field
from canonical.launchpad import _
from lp.services.fields import PillarAliases, PublicPersonChoice
+from lp.app.enums import ServiceUsage
from lp.app.errors import NotFoundError
from lp.app.interfaces.headings import IEditableContextTitle
from lp.blueprints.browser.specificationtarget import (
@@ -371,11 +372,13 @@
"""
states = {}
states['configure_bugtracker'] = (
- self.official_malone or self.context.bugtracker is not None)
- states['configure_answers'] = self.official_answers
- states['configure_translations'] = self.official_rosetta
+ self.context.bug_tracking_usage != ServiceUsage.UNKNOWN)
+ states['configure_answers'] = (
+ self.context.answers_usage != ServiceUsage.UNKNOWN)
+ states['configure_translations'] = (
+ self.context.translations_usage != ServiceUsage.UNKNOWN)
states['configure_codehosting'] = (
- self.context.development_focus.branch is not None)
+ self.context.codehosting_usage != ServiceUsage.UNKNOWN)
return states
@property
=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt 2010-08-04 12:44:06 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-08-19 21:20:59 +0000
@@ -74,7 +74,7 @@
register_blueprint
Products subclass the view to display disabled links to encourage
-configuring that service in Launchpad for the project. The project
+configuring that service in Launchpad for the project. The product
also has configuration links that make it easy to figure out where
to configure each service.
@@ -112,16 +112,17 @@
{'done': 0,
'undone': 100}
-Changing the product's official usage is reflected in the view properties.
+Changing the product's usage is reflected in the view properties.
- >>> product.official_malone = True
+ >>> from lp.app.enums import ServiceUsage
+ >>> product.translations_usage = ServiceUsage.LAUNCHPAD
>>> view = create_view(product, '+get-involved')
>>> for key in sorted(view.configuration_states.keys()):
... print key, view.configuration_states[key]
configure_answers False
- configure_bugtracker True
+ configure_bugtracker False
configure_codehosting False
- configure_translations False
+ configure_translations True
>>> print pretty(view.registration_completeness)
{'done': 25,
@@ -143,11 +144,11 @@
>>> print find_tag_by_id(rendered, 'configuration_links')
<table...
<a href="http://launchpad.dev/bread/+configure-bugtracker"...
- <span class="sprite yes">...
+ <span class="sprite no">...
<a href="http://launchpad.dev/bread/+configure-answers"...
<span class="sprite no">...
<a href="http://launchpad.dev/bread/+configure-translations"...
- <span class="sprite no">...
+ <span class="sprite yes">...
<a href="http://launchpad.dev/bread/trunk/+setbranch"...
<span class="sprite no">...
</table>
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2010-08-19 03:26:03 +0000
+++ lib/lp/registry/configure.zcml 2010-08-19 21:20:59 +0000
@@ -1090,6 +1090,9 @@
interface="lp.registry.interfaces.product.IProductEditRestricted"/>
<require
permission="launchpad.Edit"
+ set_schema="lp.app.interfaces.launchpad.IServiceUsage"/>
+ <require
+ permission="launchpad.Edit"
set_attributes="bug_reporting_guidelines
bug_reported_acknowledgement bugtracker
commercial_subscription description
=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py 2010-08-19 03:26:03 +0000
+++ lib/lp/registry/interfaces/product.py 2010-08-19 21:20:59 +0000
@@ -349,8 +349,8 @@
IHasLogo, IHasMentoringOffers, IHasMergeProposals, IHasMilestones,
IHasMugshot, IHasOwner, IHasSecurityContact, IHasSprints,
ITranslationPolicy, IKarmaContext, ILaunchpadUsage, IMakesAnnouncements,
- IOfficialBugTagTargetPublic, IPillar, IServiceUsage,
- ISpecificationTarget, IHasRecipes, IHasCodeImports):
+ IOfficialBugTagTargetPublic, IPillar, ISpecificationTarget, IHasRecipes,
+ IHasCodeImports, IServiceUsage):
"""Public IProduct properties."""
id = Int(title=_('The Project ID'))
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-08-15 23:57:23 +0000
+++ lib/lp/registry/model/product.py 2010-08-19 21:20:59 +0000
@@ -25,7 +25,6 @@
from canonical.cachedproperty import cachedproperty
from lazr.delegates import delegates
-from canonical.lazr.utils import safe_hasattr
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
from canonical.database.enumcol import EnumCol