← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/deprecate-remaining-official-bools into lp:launchpad/devel

 

Jonathan Sackett has proposed merging lp:~jcsackett/launchpad/deprecate-remaining-official-bools into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #623408 Offiical_* booleans must be deprecated in favor of usage enums
  https://bugs.launchpad.net/bugs/623408


= Summary =

Replaces, where possible, usage of official_blueprints and official_answers with their usage enum equivalents.

== Proposed fix ==

Where code uses one of the above mentioned bools, use the enum instead so that we can take advantage of richer data.

== Pre-implementation notes ==

Spoke with Curtis Hovey (sinzui) and Brad Crittenden (bac).

== Implementation details ==

As in Proposed fix.

SQL queries using the official_<app> booleans have been left alone until data migration occurs.

== Tests ==

No new tests written.

To fully test the refactor:

bin/test -m lp.registry
bin/test -m lp.answers
bin/test -m lp.blueprints

== Demo and Q/A ==

In Launchpad.dev, there should be no apparent changes to any views related to answers or blueprints.

== Launchpad lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/answers/browser/questiontarget.py
  lib/lp/answers/doc/question.txt
  lib/lp/answers/doc/questionsets.txt
  lib/lp/app/enums.py
  lib/lp/registry/adapters.py
  lib/lp/registry/configure.zcml
  lib/lp/registry/browser/distribution.py
  lib/lp/registry/browser/pillar.py
  lib/lp/registry/browser/productseries.py
  lib/lp/registry/browser/tests/distribution-views.txt
  lib/lp/registry/browser/tests/pillar-views.txt
  lib/lp/registry/browser/tests/product-views.txt
  lib/lp/registry/browser/tests/productseries-views.txt
  lib/lp/registry/browser/tests/projectgroup-views.txt
  lib/lp/registry/doc/distribution.txt
  lib/lp/registry/doc/product.txt
  lib/lp/registry/templates/distribution-index.pt
  lib/lp/registry/templates/distribution-search.pt
  lib/lp/registry/templates/distroseries-index.pt
  lib/lp/registry/templates/product-index.pt
  lib/lp/registry/templates/productseries-index.pt
  lib/lp/registry/templates/project-index.pt

-- 
https://code.launchpad.net/~jcsackett/launchpad/deprecate-remaining-official-bools/+merge/34436
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/deprecate-remaining-official-bools into lp:launchpad/devel.
=== modified file 'lib/lp/answers/browser/questiontarget.py'
--- lib/lp/answers/browser/questiontarget.py	2010-08-26 17:45:46 +0000
+++ lib/lp/answers/browser/questiontarget.py	2010-09-02 16:03:50 +0000
@@ -67,6 +67,7 @@
 from canonical.launchpad.webapp.breadcrumb import Breadcrumb
 from canonical.launchpad.webapp.menu import structured
 from canonical.widgets import LabeledMultiCheckBoxWidget
+from lp.app.enums import service_uses_launchpad
 from lp.app.errors import NotFoundError
 from lp.answers.browser.faqcollection import FAQCollectionMenu
 from lp.answers.interfaces.faqcollection import IFAQCollection
@@ -204,7 +205,7 @@
             return self.default_template
         involvement = getMultiAdapter(
             (self.context, self.request), name='+get-involved')
-        if involvement.official_answers:
+        if service_uses_launchpad(involvement.answers_usage):
             # Primary contexts that officially use answers have a
             # search and listing presentation.
             return self.default_template

=== modified file 'lib/lp/answers/doc/question.txt'
--- lib/lp/answers/doc/question.txt	2010-07-28 16:56:05 +0000
+++ lib/lp/answers/doc/question.txt	2010-09-02 16:03:50 +0000
@@ -72,13 +72,13 @@
 ==============
 
 A product or distribution may be officially supported by the community using
-the Answer Tracker.  This status is set by the official_answers attribute on
+the Answer Tracker.  This status is set by the answers_usage attribute on
 the IProduct and IDistribution.
 
-    >>> ubuntu.official_answers
-    True
-    >>> firefox.official_answers
-    True
+    >>> ubuntu.answers_usage.name
+    'LAUNCHPAD'
+    >>> firefox.answers_usage.name
+    'LAUNCHPAD'
 
 
 IQuestion interface

=== modified file 'lib/lp/answers/doc/questionsets.txt'
--- lib/lp/answers/doc/questionsets.txt	2010-07-27 17:18:24 +0000
+++ lib/lp/answers/doc/questionsets.txt	2010-09-02 16:03:50 +0000
@@ -208,14 +208,14 @@
 order of the returned projects is based on the number of questions asked
 during the period.
 
-    >>> ubuntu.official_answers
-    True
-    >>> firefox.official_answers
-    True
-    >>> landscape.official_answers
-    False
-    >>> launchpad.official_answers
-    True
+    >>> ubuntu.answers_usage.name
+    'LAUNCHPAD'
+    >>> firefox.answers_usage.name
+    'LAUNCHPAD'
+    >>> landscape.answers_usage.name
+    'UNKNOWN'
+    >>> launchpad.answers_usage.name
+    'LAUNCHPAD'
 
     # Launchpad is not returned because the question was not asked in
     # the last 60 days.

=== modified file 'lib/lp/app/enums.py'
--- lib/lp/app/enums.py	2010-08-20 20:31:18 +0000
+++ lib/lp/app/enums.py	2010-09-02 16:03:50 +0000
@@ -1,11 +1,12 @@
 # Copyright 2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""Enumerations used in the lp/app modules."""
+"""Enumerations and related utilities used in the lp/app modules."""
 
 __metaclass__ = type
 __all__ = [
     'ServiceUsage',
+    'service_uses_launchpad',
     ]
 
 from lazr.enum import (
@@ -45,3 +46,7 @@
 
     The pillar does not use this type of service in Launchpad or externally.
     """)
+
+
+def service_uses_launchpad(usage_enum):
+    return usage_enum == ServiceUsage.LAUNCHPAD

=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py	2010-08-27 19:19:27 +0000
+++ lib/lp/registry/browser/distribution.py	2010-09-02 16:03:50 +0000
@@ -75,6 +75,7 @@
 from canonical.launchpad.webapp.breadcrumb import Breadcrumb
 from canonical.launchpad.webapp.interfaces import ILaunchBag
 from canonical.widgets.image import ImageChangeWidget
+from lp.app.enums import service_uses_launchpad
 from lp.answers.browser.faqtarget import FAQTargetNavigationMixin
 from lp.answers.browser.questiontarget import (
     QuestionTargetFacetMixin,
@@ -124,10 +125,10 @@
         """Return a string of LP apps (comma-separated) this distro uses."""
         uses = []
         href_template = """<a href="%s">%s</a>"""
-        if self.context.official_answers:
+        if service_uses_launchpad(self.context.answers_usage):
             url = canonical_url(self.context, rootsite='answers')
             uses.append(href_template % (url, 'Answers'))
-        if self.context.official_blueprints:
+        if service_uses_launchpad(self.context.blueprints_usage):
             url = canonical_url(self.context, rootsite='blueprints')
             uses.append(href_template % (url, 'Blueprints'))
         if self.context.official_malone:

=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py	2010-08-31 14:45:20 +0000
+++ lib/lp/registry/browser/pillar.py	2010-09-02 16:03:50 +0000
@@ -31,8 +31,15 @@
     nearest,
     )
 from canonical.launchpad.webapp.tales import MenuAPI
+<<<<<<< TREE
 from lp.app.enums import ServiceUsage
 from lp.app.interfaces.launchpad import IServiceUsage
+=======
+from lp.app.enums import (
+    ServiceUsage,
+    service_uses_launchpad,
+    )
+>>>>>>> MERGE-SOURCE
 from lp.registry.browser.structuralsubscription import (
     StructuralSubscriptionMenuMixin,
     )
@@ -67,7 +74,7 @@
     def ask_question(self):
         return Link(
             '+addquestion', 'Ask a question', site='answers', icon='answers',
-            enabled=self.pillar.official_answers)
+            enabled=service_uses_launchpad(self.pillar.answers_usage))
 
     def help_translate(self):
         return Link(
@@ -88,8 +95,11 @@
 
     def register_blueprint(self):
         return Link(
-            '+addspec', 'Register a blueprint', site='blueprints',
-            icon='blueprints', enabled=self.pillar.official_blueprints)
+            '+addspec',
+            'Register a blueprint',
+            site='blueprints',
+            icon='blueprints', 
+            enabled=service_uses_launchpad(self.pillar.blueprints_usage))
 
 
 class PillarView(LaunchpadView):
@@ -102,8 +112,8 @@
     def __init__(self, context, request):
         super(PillarView, self).__init__(context, request)
         self.official_malone = False
-        self.official_answers = False
-        self.official_blueprints = False
+        self.answers_usage = ServiceUsage.UNKNOWN 
+        self.blueprints_usage = ServiceUsage.UNKNOWN 
         self.official_rosetta = False
         self.codehosting_usage = ServiceUsage.UNKNOWN
         pillar = nearest(self.context, IPillar)
@@ -116,11 +126,16 @@
         else:
             self._set_official_launchpad(pillar)
             if IDistroSeries.providedBy(self.context):
+<<<<<<< TREE
                 self.official_answers = False
                 distribution = self.context.distribution
                 self.codehosting_usage = distribution.codehosting_usage
+=======
+                self.answers_usage = ServiceUsage.UNKNOWN
+                self.official_codehosting = False
+>>>>>>> MERGE-SOURCE
             elif IDistributionSourcePackage.providedBy(self.context):
-                self.official_blueprints = False
+                self.blueprints_usage = ServiceUsage.UNKNOWN
                 self.official_rosetta = False
             else:
                 # The context is used by all apps.
@@ -132,10 +147,8 @@
         # times to build the complete set of official applications.
         if pillar.official_malone:
             self.official_malone = True
-        if pillar.official_answers:
-            self.official_answers = True
-        if pillar.official_blueprints:
-            self.official_blueprints = True
+        self.answers_usage = pillar.answers_usage 
+        self.blueprints_usage = pillar.blueprints_usage
         if pillar.official_rosetta:
             self.official_rosetta = True
         self.codehosting_usage = IServiceUsage(pillar).codehosting_usage
@@ -144,9 +157,16 @@
     def has_involvement(self):
         """This `IPillar` uses Launchpad."""
         return (
+<<<<<<< TREE
             self.official_malone or self.official_answers
             or self.official_blueprints or self.official_rosetta
             or self.codehosting_usage == ServiceUsage.LAUNCHPAD)
+=======
+            self.official_malone 
+            or service_uses_launchpad(self.answers_usage)
+            or service_uses_launchpad(self.blueprints_usage)
+            or self.official_rosetta or self.official_codehosting)
+>>>>>>> MERGE-SOURCE
 
     @property
     def enabled_links(self):

=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py	2010-08-27 19:19:27 +0000
+++ lib/lp/registry/browser/productseries.py	2010-09-02 16:03:50 +0000
@@ -252,11 +252,16 @@
 
     def __init__(self, context, request):
         super(ProductSeriesInvolvementView, self).__init__(context, request)
+<<<<<<< TREE
         if self.context.branch is not None:
             self.codehosting_usage = ServiceUsage.LAUNCHPAD
         else:
             self.codehosting_usage = ServiceUsage.UNKNOWN
         self.official_answers = False
+=======
+        self.official_codehosting = self.context.branch is not None
+        self.answers_usage = ServiceUsage.NOT_APPLICABLE
+>>>>>>> MERGE-SOURCE
 
     @property
     def configuration_links(self):

=== modified file 'lib/lp/registry/browser/tests/distribution-views.txt'
--- lib/lp/registry/browser/tests/distribution-views.txt	2010-06-16 08:22:00 +0000
+++ lib/lp/registry/browser/tests/distribution-views.txt	2010-09-02 16:03:50 +0000
@@ -274,11 +274,12 @@
 If the distribution officially uses the application, its portlet does appear.
 
     >>> from canonical.testing.layers import MemcachedLayer
+    >>> from lp.app.enums import ServiceUsage
 
     # When the cache regenerated, all users will see the change.
     >>> MemcachedLayer.purge()
-    >>> distribution.official_answers = True
-    >>> distribution.official_blueprints = True
+    >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
+    >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> distribution.official_malone = True
 
     >>> view = create_view(distribution, name='+index', principal=owner)

=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt	2010-08-27 17:45:57 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt	2010-09-02 16:03:50 +0000
@@ -24,7 +24,8 @@
 
 Pillars that do use launchpad applications have an involvement menu.
 
-    >>> distribution.official_answers = True
+    >>> from lp.app.enums import ServiceUsage
+    >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
     >>> distribution.official_malone = True
     >>> view = create_view(
     ...     distribution, '+get-involved', principal=distribution.owner)
@@ -33,14 +34,21 @@
 
     >>> view.official_malone
     True
-    >>> view.official_answers
-    True
+    >>> view.answers_usage.name
+    'LAUNCHPAD'
     >>> view.official_rosetta
     False
+<<<<<<< TREE
     >>> view.official_blueprints
     False
     >>> view.codehosting_usage.name
     'NOT_APPLICABLE'
+=======
+    >>> view.blueprints_usage.name
+    'UNKNOWN'
+    >>> view.official_codehosting
+    False
+>>>>>>> MERGE-SOURCE
 
 The view provides a list of enabled links that is rendered by the template.
 
@@ -65,10 +73,10 @@
 
     >>> product = factory.makeProduct(name='bread')
     >>> login_person(product.owner)
-    >>> product.official_blueprints = True
+    >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> view = create_view(product, '+get-involved')
-    >>> view.official_blueprints
-    True
+    >>> view.blueprints_usage.name
+    'LAUNCHPAD'
     >>> for link in view.enabled_links:
     ...     print link.name
     register_blueprint
@@ -114,7 +122,6 @@
 
 Changing the product's usage is reflected in the view properties.
 
-    >>> 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()):
@@ -189,8 +196,8 @@
     >>> product.project = project_group
 
     >>> view = create_view(project_group, '+get-involved')
-    >>> view.official_blueprints
-    True
+    >>> view.blueprints_usage.name
+    'LAUNCHPAD'
 
 The offical_codehosting for a project is based on whether the project's
 development focus series has a branch.
@@ -230,8 +237,9 @@
 set the links.  Despite the fact that the distribution uses blueprints,
 and translations those links are not enabled for DistributionSourcePackages.
 
+    >>> from lp.app.enums import ServiceUsage
     >>> login_person(distribution.owner)
-    >>> distribution.official_blueprints = True
+    >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> distribution.official_rosetta = True
     >>> package = factory.makeDistributionSourcePackage(
     ...     sourcepackagename="box",

=== modified file 'lib/lp/registry/browser/tests/product-views.txt'
--- lib/lp/registry/browser/tests/product-views.txt	2010-08-16 19:28:37 +0000
+++ lib/lp/registry/browser/tests/product-views.txt	2010-09-02 16:03:50 +0000
@@ -482,8 +482,9 @@
 The portlet are rendered when a product officially uses the Launchpad
 Answers, Blueprints, and Bugs applications.
 
-    >>> product.official_answers = True
-    >>> product.official_blueprints = True
+    >>> from lp.app.enums import ServiceUsage
+    >>> product.answers_usage = ServiceUsage.LAUNCHPAD
+    >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> product.official_malone = True
 
     >>> view = create_initialized_view(

=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
--- lib/lp/registry/browser/tests/productseries-views.txt	2010-08-27 19:19:27 +0000
+++ lib/lp/registry/browser/tests/productseries-views.txt	2010-09-02 16:03:50 +0000
@@ -23,18 +23,19 @@
 The ProductSeries involvement view uses the ProductSeriesInvolvedMenu when
 rendering links:
 
+    >>> from lp.app.enums import ServiceUsage
     >>> login_person(product.owner)
-    >>> product.official_answers = True
-    >>> product.official_blueprints = True
+    >>> product.answers_usage = ServiceUsage.LAUNCHPAD
+    >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> product.official_malone = True
     >>> product.official_rosetta = True
     >>> view = create_view(series, '+get-involved')
 
-    # official_answers is always false for product series.
-    >>> print view.official_answers
-    False
-    >>> print view.official_blueprints
-    True
+    # answers_usage is never LAUNCHPAD for product series.
+    >>> print view.answers_usage.name
+    UNKNOWN
+    >>> print view.blueprints_usage.name
+    'LAUNCHPAD'
     >>> print view.official_malone
     True
     >>> print view.official_rosetta

=== modified file 'lib/lp/registry/browser/tests/projectgroup-views.txt'
--- lib/lp/registry/browser/tests/projectgroup-views.txt	2009-08-31 20:46:06 +0000
+++ lib/lp/registry/browser/tests/projectgroup-views.txt	2010-09-02 16:03:50 +0000
@@ -71,8 +71,9 @@
 The portlet are rendered when a child product officially uses the Launchpad
 Answers, Blueprints, and Bugs applications.
 
-    >>> product.official_answers = True
-    >>> product.official_blueprints = True
+    >>> from lp.app.enums import ServiceUsage
+    >>> product.answers_usage = ServiceUsage.LAUNCHPAD
+    >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
     >>> product.official_malone = True
 
     >>> view = create_view(projectgroup, name='+index', principal=owner)

=== modified file 'lib/lp/registry/doc/distribution.txt'
--- lib/lp/registry/doc/distribution.txt	2010-08-23 00:51:30 +0000
+++ lib/lp/registry/doc/distribution.txt	2010-09-02 16:03:50 +0000
@@ -1,4 +1,5 @@
-= Distributions =
+Distributions
+=============
 
 From the DerivationOverview spec
 <https://launchpad.canonical.com/DerivationOverview>:
@@ -143,7 +144,8 @@
     False
 
 
-== Distribution Sorting ==
+Distribution Sorting
+--------------------
 
 If you ask for all the distributions in the DistributionSet you should get
 Ubuntu (and all flavours of it) first and the rest alphabetically:
@@ -164,7 +166,8 @@
     True
 
 
-=== Searching for DistributionSourcePackages ===
+Searching for DistributionSourcePackages
+........................................
 
 The distribution also allows you to look for source packages that match
 a certain string through the magic of fti. For instance:
@@ -232,7 +235,8 @@
     DistributionSourcePackage: alsa-utils
 
 
-=== Searching for binary packages ===
+Searching for binary packages
+.............................
 
 There are two useful functions for searching binary packages related
 to the distribution, searchBinaryPackages() and searchBinaryPackagesFTI().
@@ -291,7 +295,8 @@
     [u'mozilla-firefox']
 
 
-=== Finding distroseriess and pockets from distribution names ===
+Finding distroseriess and pockets from distribution names
+.........................................................
 
 A distribution knows what distroseriess it has. Those distroseriess have
 pockets which have suffixes used by the archive publisher. Because we
@@ -336,7 +341,8 @@
     NotFoundError: 'hoary-bullshit'
 
 
-=== Upload related stuff ===
+Upload related stuff
+....................
 
 When uploading to a distribution we need to query its uploaders. Each
 uploader record is in fact an ArchivePermission record that tells us
@@ -375,7 +381,8 @@
     AssertionError: searching in an explicitly empty space is pointless
 
 
-=== Launchpad Usage ===
+Launchpad Usage
+...............
 
 A distribution can specify if it uses Malone, Rosetta, or Answers
 officially. Ubuntu uses all of them:
@@ -387,10 +394,10 @@
     True
     >>> ubuntu.official_rosetta
     True
-    >>> ubuntu.official_answers
-    True
-    >>> ubuntu.official_blueprints
-    True
+    >>> ubuntu.answers_usage.name
+    'LAUNCHPAD'
+    >>> ubuntu.blueprints_usage.name
+    'LAUNCHPAD'
 
 The bug_tracking_usage property currently only tracks official_malone.
 
@@ -403,8 +410,8 @@
     True
     >>> print ubuntu.translations_usage.name
     LAUNCHPAD 
-    >>> print ubuntu.official_answers
-    True
+    >>> print ubuntu.answers_usage.name
+    LAUNCHPAD
     >>> print ubuntu.answers_usage.name
     LAUNCHPAD
     >>> print ubuntu.official_blueprints
@@ -438,12 +445,12 @@
     False
     >>> debian.official_rosetta
     False
-    >>> debian.official_answers
-    False
+    >>> debian.answers_usage.name
+    'LAUNCHPAD' 
     >>> debian.official_codehosting
     False
-    >>> debian.official_blueprints
-    False
+    >>> debian.blueprints_usage.name
+    'UNKNOWN'
 
 Gentoo only uses Malone
 
@@ -451,16 +458,17 @@
     True
     >>> print gentoo.official_rosetta
     False
-    >>> print gentoo.official_answers
-    False
+    >>> print gentoo.answers_usage.name
+    'LAUNCHPAD'
 
 Launchpad admins and the distro owner can set these fields.
 
+    >>> from lp.app.enums import ServiceUsage
     >>> login('mark@xxxxxxxxxxx')
     >>> debian = getUtility(ILaunchpadCelebrities).debian
-    >>> debian.official_blueprints = True
-    >>> debian.official_blueprints
-    True
+    >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
+    >>> debian.bluprints_usage.name
+    'LAUNCHPAD'
     >>> debian.official_malone = True
     >>> debian.official_malone
     True
@@ -471,16 +479,16 @@
     >>> debian_owner = factory.makePerson()
     >>> debian.owner = debian_owner
     >>> login_person(debian_owner)
-    >>> debian.official_blueprints = False
-    >>> debian.official_blueprints
-    False
+    >>> debian.blueprints_usage = ServiceUsage.NOT_APPLICABLE
+    >>> debian.blueprints_usage.name
+    'NOT_APPLICABLE'
 
 But others can't.
 
     >>> login('no-priv@xxxxxxxxxxxxx')
-    >>> debian.official_blueprints = True
+    >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
     Traceback (most recent call last):
-    Unauthorized: (..., 'official_blueprints', 'launchpad.Edit')
+    Unauthorized: (..., 'blueprints_usage', 'launchpad.Edit')
     >>> debian.official_malone = True
     Traceback (most recent call last):
     Unauthorized: (..., 'official_malone', 'launchpad.Edit')
@@ -489,7 +497,8 @@
     Unauthorized: (..., 'official_rosetta', 'launchpad.Edit')
 
 
-=== Specification Listings ===
+Specification Listings
+......................
 
 We should be able to get lists of specifications in different states
 related to a distro.
@@ -580,7 +589,8 @@
  kde-desktopfile-langpacks
 
 
-== Milestones ==
+Milestones
+----------
 
 We can use IDistribution.milestones to get all milestones associated with any
 series of a distribution.
@@ -623,7 +633,8 @@
     [u'3.1', u'3.1-rc1', u'woody-rc1']
 
 
-== Archives ==
+Archives
+--------
 
 A distribution archive (primary, partner, debug or copy) can be retrieved
 by name using IDistribution.getArchive.

=== modified file 'lib/lp/registry/doc/product.txt'
--- lib/lp/registry/doc/product.txt	2010-08-22 19:46:19 +0000
+++ lib/lp/registry/doc/product.txt	2010-09-02 16:03:50 +0000
@@ -1,4 +1,5 @@
-= Product =
+Product
+=======
 
 Launchpad keeps track of the "upstream" world as well as the "distro" world.
 The anchorpiece of the "upstream" world is the Product, which is a piece of
@@ -162,7 +163,8 @@
     Obsolete Junk
 
 
-== Translatable Products ==
+Translatable Products
+---------------------
 
 IProductSet will also tell us which products can be translated:
 
@@ -307,21 +309,23 @@
     True
 
 
-== Answer Tracking ==
+Answer Tracking
+---------------
 
 Firefox uses the Answer Tracker as the official application to provide
 answers to questions.
 
-    >>> firefox.official_answers
-    True
+    >>> firefox.answers_usage.name
+    'LAUNCHPAD'
 
 Alsa does not use Launchpad to track answers.
 
-    >>> alsa.official_answers
-    False
-
-
-== Product Creation ==
+    >>> alsa.answers_usage.name
+    'UNKNOWN'
+
+
+Product Creation
+----------------
 
 We can create new products with the createProduct() method:
 
@@ -374,20 +378,22 @@
     True
 
 
-== Specification Listings ==
+Specification Listings
+----------------------
 
 We should be able to set whether or not a Product uses specifications
-officially.  It defaults to False.
+officially.  It defaults to UNKNOWN.
 
  >>> firefox = productset.getByName('firefox')
- >>> firefox.official_blueprints
- False
-
-We can change it to True.
-
- >>> firefox.official_blueprints = True
- >>> firefox.official_blueprints
- True
+ >>> firefox.blueprints_usage.name
+ 'UNKNOWN'
+
+We can change it to use LAUNCHPAD.
+
+ >>> from lp.app.enums import ServiceUsage
+ >>> firefox.blueprints_usage = ServiceUsage.LAUNCHPAD
+ >>> firefox.blueprints_usage.name
+ 'LAUNCHPAD'
 
 We should be able to get lists of specifications in different states
 related to a product.
@@ -427,7 +433,8 @@
  e4x
 
 
-== Milestones ==
+Milestones
+----------
 
 We can use IProduct.milestones to get all milestones associated with any
 ProductSeries of a product.
@@ -470,7 +477,8 @@
     [u'1.0.0', u'0.9.2', u'0.9.1', u'0.9', u'1.0', u'1.0-rc1']
 
 
-== Release ==
+Release
+-------
 
 All the releases for a Product can be retrieved through the releases property.
 
@@ -489,7 +497,8 @@
     0.9.1
 
 
-== Products With Branches ==
+Products With Branches
+----------------------
 
 Products are considered to officially support Launchpad as a location
 for their branches after a branch is set for the development focus
@@ -568,7 +577,8 @@
     landscape
 
 
-== Primary translatable ==
+Primary translatable
+--------------------
 
 Primary translatable series in a product should follow series where
 development is focused on.  To be able to do changes to facilitate
@@ -642,7 +652,8 @@
     1.0
 
 
-= Series list =
+Series list
+===========
 
 The series for a product are returned as a sorted list, with the
 exception that the current development focus is first.
@@ -697,7 +708,8 @@
     ...     print series.name
     trunk
 
-= Changing ownership =
+Changing ownership
+==================
 
 If the owner of a project changes, all series and productreleases
 owned by the old owner are transfered to the new owner.

=== modified file 'lib/lp/registry/templates/distribution-index.pt'
--- lib/lp/registry/templates/distribution-index.pt	2010-08-06 16:01:38 +0000
+++ lib/lp/registry/templates/distribution-index.pt	2010-09-02 16:03:50 +0000
@@ -52,7 +52,7 @@
       <div class="yui-g">
         <div class="yui-u first">
           <div tal:replace="structure context/@@+portlet-listfaqs"
-            tal:condition="context/official_answers" />
+            tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:replace="structure context/@@+portlet-latestbugs"
             tal:condition="context/official_malone" />
@@ -62,10 +62,10 @@
 
         <div class="yui-u">
           <div tal:replace="structure context/@@+portlet-latestquestions"
-            tal:condition="context/official_answers" />
+            tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:replace="structure context/@@+portlet-latestspecs"
-            tal:condition="context/official_blueprints" />
+            tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:replace="structure context/@@+portlet-coming-sprints" />
         </div>

=== modified file 'lib/lp/registry/templates/distribution-search.pt'
--- lib/lp/registry/templates/distribution-search.pt	2009-08-05 19:34:07 +0000
+++ lib/lp/registry/templates/distribution-search.pt	2010-09-02 16:03:50 +0000
@@ -77,7 +77,7 @@
                     </a>
                     <a
                       tal:define="link package/menu:answers/new"
-                      tal:condition="distribution/official_answers"
+                      tal:condition="distribution/answers_usage/enumvalue:LAUNCHPAD"
                       tal:attributes="href link/url">
                     <img
                       tal:attributes="alt link/text"

=== modified file 'lib/lp/registry/templates/distroseries-index.pt'
--- lib/lp/registry/templates/distroseries-index.pt	2010-08-06 16:01:38 +0000
+++ lib/lp/registry/templates/distroseries-index.pt	2010-09-02 16:03:50 +0000
@@ -83,7 +83,8 @@
 
           <div
             tal:content="structure context/@@+portlet-latestspecs"
-            tal:condition="context/@@+get-involved/official_blueprints" />
+            tal:define="blueprints_usage context/@@+get-involved/blueprints_usage"
+            condition="blueprints_usage/enumvalue:LAUNCHPAD" />
 
           <div
            tal:replace="structure context/distribution/@@+portlet-coming-sprints" />

=== modified file 'lib/lp/registry/templates/product-index.pt'
--- lib/lp/registry/templates/product-index.pt	2010-08-25 19:15:48 +0000
+++ lib/lp/registry/templates/product-index.pt	2010-09-02 16:03:50 +0000
@@ -215,7 +215,7 @@
       <div class="yui-g">
         <div class="yui-u first">
           <div tal:content="structure context/@@+portlet-listfaqs"
-            tal:condition="context/official_answers" />
+            tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:content="structure context/@@+portlet-latestbugs"
             tal:condition="context/official_malone" />
@@ -227,10 +227,10 @@
 
         <div class="yui-u">
           <div tal:content="structure context/@@+portlet-latestquestions"
-            tal:condition="context/official_answers" />
+            tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:content="structure context/@@+portlet-latestspecs"
-            tal:condition="context/official_blueprints" />
+            tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
 
           <div tal:content="structure context/@@+portlet-coming-sprints" />
         </div>

=== modified file 'lib/lp/registry/templates/productseries-index.pt'
--- lib/lp/registry/templates/productseries-index.pt	2010-02-11 20:59:29 +0000
+++ lib/lp/registry/templates/productseries-index.pt	2010-09-02 16:03:50 +0000
@@ -145,7 +145,8 @@
         <div class="yui-u">
           <div
             tal:content="structure context/@@+portlet-latestspecs"
-            tal:condition="context/@@+get-involved/official_blueprints" />
+            tal:define="blueprints_usage context/@@+get-involved/blueprints_usage"
+            condition="official_blueprints/enumvalue:LAUNCHPAD" />
 
           <div tal:replace="structure context/product/@@+portlet-coming-sprints" />
 

=== modified file 'lib/lp/registry/templates/project-index.pt'
--- lib/lp/registry/templates/project-index.pt	2010-05-17 20:09:03 +0000
+++ lib/lp/registry/templates/project-index.pt	2010-09-02 16:03:50 +0000
@@ -72,11 +72,13 @@
         <tal:details replace="structure context/@@+details" />
 
         <tal:faqs content="structure context/@@+portlet-listfaqs"
-          condition="context/@@+get-involved/official_answers" />
+          define="answers_usage context/@@+get-involved/answers_usage"
+          condition="answers_usage/enumvalue:LAUNCHPAD" />
 
         <tal:has-many-project condition="view/has_many_projects">
           <tal:questions content="structure context/@@+portlet-latestquestions"
-            condition="context/@@+get-involved/official_answers" />
+            define="answers_usage context/@@+get-involved/answers_usage"
+            condition="answers_usage/enumvalue:LAUNCHPAD" />
         </tal:has-many-project>
 
         <tal:bugs content="structure context/@@+portlet-latestbugs"
@@ -84,7 +86,8 @@
 
         <tal:has-many-project condition="view/has_many_projects">
           <tal:specs content="structure context/@@+portlet-latestspecs"
-            condition="context/@@+get-involved/official_blueprints" />
+            define="blueprints_usage context/@@+get-involved/blueprints_usage"
+            condition="blueprints_usage/enumvalue:LAUNCHPAD" />
         </tal:has-many-project>
 
         <tal:contributors content="structure context/@@+portlet-top-contributors"/>
@@ -119,10 +122,12 @@
 
         <tal:has-few-project condition="not: view/has_many_projects">
           <tal:questions content="structure context/@@+portlet-latestquestions"
-            condition="context/@@+get-involved/official_answers" />
+            define="answers_usage context/@@+get-involved/answers_usage"
+            condition="answers_usage/enumvalue:LAUNCHPAD" />
 
           <tal:specs content="structure context/@@+portlet-latestspecs"
-            condition="context/@@+get-involved/official_blueprints" />
+            define="blueprints_usage context/@@+get-involved/blueprints_usage"
+            condition="blueprints_usage/enumvalue:LAUNCHPAD" />
 
           <tal:sprints content="structure context/@@+portlet-coming-sprints" />
         </tal:has-few-project>