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

Proposed by j.c.sackett
Status: Merged
Approved by: Paul Hummer
Approved revision: no longer in the source branch.
Merged at revision: 11528
Proposed branch: lp:~jcsackett/launchpad/deprecate-remaining-official-bools
Merge into: lp:launchpad
Diff against target: 632 lines (+121/-109)
19 files modified
lib/lp/answers/browser/questiontarget.py (+2/-1)
lib/lp/answers/doc/question.txt (+5/-5)
lib/lp/answers/doc/questionsets.txt (+8/-8)
lib/lp/registry/browser/distribution.py (+2/-2)
lib/lp/registry/browser/pillar.py (+21/-16)
lib/lp/registry/browser/productseries.py (+1/-1)
lib/lp/registry/browser/tests/distribution-views.txt (+3/-2)
lib/lp/registry/browser/tests/pillar-views.txt (+20/-20)
lib/lp/registry/browser/tests/product-views.txt (+3/-2)
lib/lp/registry/browser/tests/productseries-views.txt (+7/-7)
lib/lp/registry/browser/tests/projectgroup-views.txt (+4/-2)
lib/lp/registry/doc/distribution.txt (+15/-14)
lib/lp/registry/doc/product.txt (+14/-14)
lib/lp/registry/templates/distribution-index.pt (+3/-3)
lib/lp/registry/templates/distribution-search.pt (+2/-2)
lib/lp/registry/templates/distroseries-index.pt (+2/-1)
lib/lp/registry/templates/product-index.pt (+3/-3)
lib/lp/registry/templates/productseries-index.pt (+1/-1)
lib/lp/registry/templates/project-index.pt (+5/-5)
To merge this branch: bzr merge lp:~jcsackett/launchpad/deprecate-remaining-official-bools
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Review via email: mp+34436@code.launchpad.net

Commit message

Replaces use of official_answers and official_blueprints with their usage enum equivalents.

Description of the change

= 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

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

25 @@ -72,13 +72,13 @@
26 ==============
27
28 A product or distribution may be officially supported by the community using
29 -the Answer Tracker. This status is set by the official_answers attribute on
30 +the Answer Tracker. This status is set by the answers_usage attribute on
31 the IProduct and IDistribution.
32
33 - >>> ubuntu.official_answers
34 - True
35 - >>> firefox.official_answers
36 - True
37 + >>> ubuntu.answers_usage.name
38 + 'LAUNCHPAD'
39 + >>> firefox.answers_usage.name
40 + 'LAUNCHPAD'

I'd rather you print these than just getting the value.

342 === modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
343 --- lib/lp/registry/browser/tests/productseries-views.txt 2010-08-27 19:19:27 +0000
344 +++ lib/lp/registry/browser/tests/productseries-views.txt 2010-09-02 16:47:49 +0000
345 @@ -23,18 +23,19 @@
346 The ProductSeries involvement view uses the ProductSeriesInvolvedMenu when
347 rendering links:
348
349 + >>> from lp.app.enums import ServiceUsage
350 >>> login_person(product.owner)
351 - >>> product.official_answers = True
352 - >>> product.official_blueprints = True
353 + >>> product.answers_usage = ServiceUsage.LAUNCHPAD
354 + >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
355 >>> product.official_malone = True
356 >>> product.official_rosetta = True
357 >>> view = create_view(series, '+get-involved')
358
359 - # official_answers is always false for product series.
360 - >>> print view.official_answers
361 - False
362 - >>> print view.official_blueprints
363 - True
364 + # answers_usage is never LAUNCHPAD for product series.
365 + >>> print view.answers_usage.name
366 + UNKNOWN
367 + >>> print view.blueprints_usage.name
368 + 'LAUNCHPAD'

Hm, how does this work? If you're printing the value here, why are you still getting quotes?

So I think I'd rather you print all the values instead of getting them as strings, and I think you might need to run these tests to make sure you're getting the right values. I suspect in some case you're printing something and expecting the quoted value instead of the string.

Thanks for updating the doctests. One more doctest up to date.

review: Needs Information
Revision history for this message
j.c.sackett (jcsackett) wrote :

> 37 + >>> ubuntu.answers_usage.name
> 38 + 'LAUNCHPAD'
> 39 + >>> firefox.answers_usage.name
> 40 + 'LAUNCHPAD'
>
> I'd rather you print these than just getting the value.

I was debating this myself prior to the review. This (and other instances) are fixed.

> 367 + >>> print view.blueprints_usage.name
> 368 + 'LAUNCHPAD'
>
> Hm, how does this work? If you're printing the value here, why are you still getting quotes?

It doesn't work. I believe that was a casualty of my wavering on how to go about setting up those tests. It too has been resolved.

> Thanks for updating the doctests. One more doctest up to date.

Happy to do it.

//j.c.sackett

Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/answers/browser/questiontarget.py'
--- lib/lp/answers/browser/questiontarget.py 2010-08-31 11:31:04 +0000
+++ lib/lp/answers/browser/questiontarget.py 2010-09-10 13:32:47 +0000
@@ -78,6 +78,7 @@
78 IQuestionTarget,78 IQuestionTarget,
79 ISearchQuestionsForm,79 ISearchQuestionsForm,
80 )80 )
81from lp.app.enums import service_uses_launchpad
81from lp.app.errors import NotFoundError82from lp.app.errors import NotFoundError
82from lp.registry.interfaces.distribution import IDistribution83from lp.registry.interfaces.distribution import IDistribution
83from lp.registry.interfaces.product import IProduct84from lp.registry.interfaces.product import IProduct
@@ -204,7 +205,7 @@
204 return self.default_template205 return self.default_template
205 involvement = getMultiAdapter(206 involvement = getMultiAdapter(
206 (self.context, self.request), name='+get-involved')207 (self.context, self.request), name='+get-involved')
207 if involvement.official_answers:208 if service_uses_launchpad(involvement.answers_usage):
208 # Primary contexts that officially use answers have a209 # Primary contexts that officially use answers have a
209 # search and listing presentation.210 # search and listing presentation.
210 return self.default_template211 return self.default_template
211212
=== 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-10 13:32:47 +0000
@@ -72,13 +72,13 @@
72==============72==============
7373
74A product or distribution may be officially supported by the community using74A product or distribution may be officially supported by the community using
75the Answer Tracker. This status is set by the official_answers attribute on75the Answer Tracker. This status is set by the answers_usage attribute on
76the IProduct and IDistribution.76the IProduct and IDistribution.
7777
78 >>> ubuntu.official_answers78 >>> print ubuntu.answers_usage.name
79 True79 LAUNCHPAD
80 >>> firefox.official_answers80 >>> print firefox.answers_usage.name
81 True81 LAUNCHPAD
8282
8383
84IQuestion interface84IQuestion interface
8585
=== 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-10 13:32:47 +0000
@@ -208,14 +208,14 @@
208order of the returned projects is based on the number of questions asked208order of the returned projects is based on the number of questions asked
209during the period.209during the period.
210210
211 >>> ubuntu.official_answers211 >>> print ubuntu.answers_usage.name
212 True212 LAUNCHPAD
213 >>> firefox.official_answers213 >>> print firefox.answers_usage.name
214 True214 LAUNCHPAD
215 >>> landscape.official_answers215 >>> print landscape.answers_usage.name
216 False216 UNKNOWN
217 >>> launchpad.official_answers217 >>> print launchpad.answers_usage.name
218 True218 LAUNCHPAD
219219
220 # Launchpad is not returned because the question was not asked in220 # Launchpad is not returned because the question was not asked in
221 # the last 60 days.221 # the last 60 days.
222222
=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py 2010-09-03 13:29:58 +0000
+++ lib/lp/registry/browser/distribution.py 2010-09-10 13:32:47 +0000
@@ -123,10 +123,10 @@
123 """Return a string of LP apps (comma-separated) this distro uses."""123 """Return a string of LP apps (comma-separated) this distro uses."""
124 uses = []124 uses = []
125 href_template = """<a href="%s">%s</a>"""125 href_template = """<a href="%s">%s</a>"""
126 if self.context.official_answers:126 if service_uses_launchpad(self.context.answers_usage):
127 url = canonical_url(self.context, rootsite='answers')127 url = canonical_url(self.context, rootsite='answers')
128 uses.append(href_template % (url, 'Answers'))128 uses.append(href_template % (url, 'Answers'))
129 if self.context.official_blueprints:129 if service_uses_launchpad(self.context.blueprints_usage):
130 url = canonical_url(self.context, rootsite='blueprints')130 url = canonical_url(self.context, rootsite='blueprints')
131 uses.append(href_template % (url, 'Blueprints'))131 uses.append(href_template % (url, 'Blueprints'))
132 if self.context.official_malone:132 if self.context.official_malone:
133133
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2010-09-03 13:29:58 +0000
+++ lib/lp/registry/browser/pillar.py 2010-09-10 13:32:47 +0000
@@ -70,7 +70,7 @@
70 def ask_question(self):70 def ask_question(self):
71 return Link(71 return Link(
72 '+addquestion', 'Ask a question', site='answers', icon='answers',72 '+addquestion', 'Ask a question', site='answers', icon='answers',
73 enabled=self.pillar.official_answers)73 enabled=service_uses_launchpad(self.pillar.answers_usage))
7474
75 def help_translate(self):75 def help_translate(self):
76 return Link(76 return Link(
@@ -91,8 +91,11 @@
9191
92 def register_blueprint(self):92 def register_blueprint(self):
93 return Link(93 return Link(
94 '+addspec', 'Register a blueprint', site='blueprints',94 '+addspec',
95 icon='blueprints', enabled=self.pillar.official_blueprints)95 'Register a blueprint',
96 site='blueprints',
97 icon='blueprints',
98 enabled=service_uses_launchpad(self.pillar.blueprints_usage))
9699
97100
98class PillarView(LaunchpadView):101class PillarView(LaunchpadView):
@@ -105,8 +108,8 @@
105 def __init__(self, context, request):108 def __init__(self, context, request):
106 super(PillarView, self).__init__(context, request)109 super(PillarView, self).__init__(context, request)
107 self.official_malone = False110 self.official_malone = False
108 self.official_answers = False111 self.answers_usage = ServiceUsage.UNKNOWN
109 self.official_blueprints = False112 self.blueprints_usage = ServiceUsage.UNKNOWN
110 self.translations_usage = ServiceUsage.UNKNOWN113 self.translations_usage = ServiceUsage.UNKNOWN
111 self.codehosting_usage = ServiceUsage.UNKNOWN114 self.codehosting_usage = ServiceUsage.UNKNOWN
112 pillar = nearest(self.context, IPillar)115 pillar = nearest(self.context, IPillar)
@@ -119,11 +122,11 @@
119 else:122 else:
120 self._set_official_launchpad(pillar)123 self._set_official_launchpad(pillar)
121 if IDistroSeries.providedBy(self.context):124 if IDistroSeries.providedBy(self.context):
122 self.official_answers = False
123 distribution = self.context.distribution125 distribution = self.context.distribution
124 self.codehosting_usage = distribution.codehosting_usage126 self.codehosting_usage = distribution.codehosting_usage
127 self.answers_usage = ServiceUsage.NOT_APPLICABLE
125 elif IDistributionSourcePackage.providedBy(self.context):128 elif IDistributionSourcePackage.providedBy(self.context):
126 self.official_blueprints = False129 self.blueprints_usage = ServiceUsage.UNKNOWN
127 self.translations_usage = ServiceUsage.UNKNOWN130 self.translations_usage = ServiceUsage.UNKNOWN
128 else:131 else:
129 # The context is used by all apps.132 # The context is used by all apps.
@@ -135,19 +138,21 @@
135 # times to build the complete set of official applications.138 # times to build the complete set of official applications.
136 if pillar.official_malone:139 if pillar.official_malone:
137 self.official_malone = True140 self.official_malone = True
138 if pillar.official_answers:141 if service_uses_launchpad(IServiceUsage(pillar).answers_usage):
139 self.official_answers = True142 self.answers_usage = ServiceUsage.LAUNCHPAD
140 if pillar.official_blueprints:143 if service_uses_launchpad(IServiceUsage(pillar).blueprints_usage):
141 self.official_blueprints = True144 self.blueprints_usage = ServiceUsage.LAUNCHPAD
142 self.translations_usage = IServiceUsage(pillar).translations_usage145 if service_uses_launchpad(pillar.translations_usage):
143 self.codehosting_usage = IServiceUsage(pillar).codehosting_usage146 self.translations_usage = ServiceUsage.LAUNCHPAD
147 if service_uses_launchpad(IServiceUsage(pillar).codehosting_usage):
148 self.codehosting_usage = ServiceUsage.LAUNCHPAD
144149
145 @property150 @property
146 def has_involvement(self):151 def has_involvement(self):
147 """This `IPillar` uses Launchpad."""152 """This `IPillar` uses Launchpad."""
148 return (153 return (self.official_malone
149 self.official_malone or self.official_answers154 or service_uses_launchpad(self.answers_usage)
150 or self.official_blueprints155 or service_uses_launchpad(self.blueprints_usage)
151 or service_uses_launchpad(self.translations_usage)156 or service_uses_launchpad(self.translations_usage)
152 or service_uses_launchpad(self.codehosting_usage))157 or service_uses_launchpad(self.codehosting_usage))
153158
154159
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2010-09-03 15:02:39 +0000
+++ lib/lp/registry/browser/productseries.py 2010-09-10 13:32:47 +0000
@@ -254,11 +254,11 @@
254254
255 def __init__(self, context, request):255 def __init__(self, context, request):
256 super(ProductSeriesInvolvementView, self).__init__(context, request)256 super(ProductSeriesInvolvementView, self).__init__(context, request)
257 self.answers_usage = ServiceUsage.NOT_APPLICABLE
257 if self.context.branch is not None:258 if self.context.branch is not None:
258 self.codehosting_usage = ServiceUsage.LAUNCHPAD259 self.codehosting_usage = ServiceUsage.LAUNCHPAD
259 else:260 else:
260 self.codehosting_usage = ServiceUsage.UNKNOWN261 self.codehosting_usage = ServiceUsage.UNKNOWN
261 self.official_answers = False
262262
263 @property263 @property
264 def configuration_links(self):264 def configuration_links(self):
265265
=== modified file 'lib/lp/registry/browser/tests/distribution-views.txt'
--- lib/lp/registry/browser/tests/distribution-views.txt 2010-08-30 18:26:19 +0000
+++ lib/lp/registry/browser/tests/distribution-views.txt 2010-09-10 13:32:47 +0000
@@ -274,11 +274,12 @@
274If the distribution officially uses the application, its portlet does appear.274If the distribution officially uses the application, its portlet does appear.
275275
276 >>> from canonical.testing.layers import MemcachedLayer276 >>> from canonical.testing.layers import MemcachedLayer
277 >>> from lp.app.enums import ServiceUsage
277278
278 # When the cache regenerated, all users will see the change.279 # When the cache regenerated, all users will see the change.
279 >>> MemcachedLayer.purge()280 >>> MemcachedLayer.purge()
280 >>> distribution.official_answers = True281 >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
281 >>> distribution.official_blueprints = True282 >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
282 >>> distribution.official_malone = True283 >>> distribution.official_malone = True
283284
284 >>> view = create_view(distribution, name='+index', principal=owner)285 >>> view = create_view(distribution, name='+index', principal=owner)
285286
=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt 2010-09-01 22:59:30 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-09-10 13:32:47 +0000
@@ -24,7 +24,8 @@
2424
25Pillars that do use launchpad applications have an involvement menu.25Pillars that do use launchpad applications have an involvement menu.
2626
27 >>> distribution.official_answers = True27 >>> from lp.app.enums import ServiceUsage
28 >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
28 >>> distribution.official_malone = True29 >>> distribution.official_malone = True
29 >>> view = create_view(30 >>> view = create_view(
30 ... distribution, '+get-involved', principal=distribution.owner)31 ... distribution, '+get-involved', principal=distribution.owner)
@@ -33,14 +34,14 @@
3334
34 >>> view.official_malone35 >>> view.official_malone
35 True36 True
36 >>> view.official_answers37 >>> print view.answers_usage.name
37 True38 LAUNCHPAD
38 >>> view.translations_usage.name39 >>> view.translations_usage.name
39 'UNKNOWN'40 'UNKNOWN'
40 >>> view.official_blueprints41 >>> print view.blueprints_usage.name
41 False42 UNKNOWN
42 >>> view.codehosting_usage.name43 >>> print view.codehosting_usage.name
43 'NOT_APPLICABLE'44 UNKNOWN
4445
45The view provides a list of enabled links that is rendered by the template.46The view provides a list of enabled links that is rendered by the template.
4647
@@ -65,10 +66,10 @@
6566
66 >>> product = factory.makeProduct(name='bread')67 >>> product = factory.makeProduct(name='bread')
67 >>> login_person(product.owner)68 >>> login_person(product.owner)
68 >>> product.official_blueprints = True69 >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
69 >>> view = create_view(product, '+get-involved')70 >>> view = create_view(product, '+get-involved')
70 >>> view.official_blueprints71 >>> print view.blueprints_usage.name
71 True72 LAUNCHPAD
72 >>> for link in view.enabled_links:73 >>> for link in view.enabled_links:
73 ... print link.name74 ... print link.name
74 register_blueprint75 register_blueprint
@@ -114,7 +115,6 @@
114115
115Changing the product's usage is reflected in the view properties.116Changing the product's usage is reflected in the view properties.
116117
117 >>> from lp.app.enums import ServiceUsage
118 >>> product.translations_usage = ServiceUsage.LAUNCHPAD118 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
119 >>> view = create_view(product, '+get-involved')119 >>> view = create_view(product, '+get-involved')
120 >>> for key in sorted(view.configuration_states.keys()):120 >>> for key in sorted(view.configuration_states.keys()):
@@ -189,8 +189,8 @@
189 >>> product.project = project_group189 >>> product.project = project_group
190190
191 >>> view = create_view(project_group, '+get-involved')191 >>> view = create_view(project_group, '+get-involved')
192 >>> view.official_blueprints192 >>> print view.blueprints_usage.name
193 True193 LAUNCHPAD
194194
195The offical_codehosting for a project is based on whether the project's195The offical_codehosting for a project is based on whether the project's
196development focus series has a branch.196development focus series has a branch.
@@ -200,23 +200,23 @@
200 >>> product.official_codehosting200 >>> product.official_codehosting
201 False201 False
202 >>> view = create_view(product, '+get-involved')202 >>> view = create_view(product, '+get-involved')
203 >>> view.codehosting_usage.name203 >>> print view.codehosting_usage.name
204 'UNKNOWN'204 UNKNOWN
205205
206 >>> product.development_focus.branch = factory.makeBranch(206 >>> product.development_focus.branch = factory.makeBranch(
207 ... product=product)207 ... product=product)
208 >>> product.official_codehosting208 >>> product.official_codehosting
209 True209 True
210 >>> view = create_view(product, '+get-involved')210 >>> view = create_view(product, '+get-involved')
211 >>> view.codehosting_usage.name211 >>> print view.codehosting_usage.name
212 'LAUNCHPAD' 212 LAUNCHPAD
213213
214Project groups cannot make links to register a branch, so214Project groups cannot make links to register a branch, so
215official_codehosting is always false.215official_codehosting is always false.
216216
217 >>> view = create_view(project_group, '+get-involved')217 >>> view = create_view(project_group, '+get-involved')
218 >>> view.codehosting_usage.name218 >>> print view.codehosting_usage.name
219 'NOT_APPLICABLE'219 NOT_APPLICABLE
220220
221DistroSeries can use this view. The distribution is used to set the links.221DistroSeries can use this view. The distribution is used to set the links.
222222
@@ -232,7 +232,7 @@
232232
233 >>> from lp.app.enums import ServiceUsage233 >>> from lp.app.enums import ServiceUsage
234 >>> login_person(distribution.owner)234 >>> login_person(distribution.owner)
235 >>> distribution.official_blueprints = True235 >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
236 >>> distribution.translations_usage = ServiceUsage.LAUNCHPAD236 >>> distribution.translations_usage = ServiceUsage.LAUNCHPAD
237 >>> package = factory.makeDistributionSourcePackage(237 >>> package = factory.makeDistributionSourcePackage(
238 ... sourcepackagename="box",238 ... sourcepackagename="box",
239239
=== 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-10 13:32:47 +0000
@@ -482,8 +482,9 @@
482The portlet are rendered when a product officially uses the Launchpad482The portlet are rendered when a product officially uses the Launchpad
483Answers, Blueprints, and Bugs applications.483Answers, Blueprints, and Bugs applications.
484484
485 >>> product.official_answers = True485 >>> from lp.app.enums import ServiceUsage
486 >>> product.official_blueprints = True486 >>> product.answers_usage = ServiceUsage.LAUNCHPAD
487 >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
487 >>> product.official_malone = True488 >>> product.official_malone = True
488489
489 >>> view = create_initialized_view(490 >>> view = create_initialized_view(
490491
=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
--- lib/lp/registry/browser/tests/productseries-views.txt 2010-09-09 15:26:11 +0000
+++ lib/lp/registry/browser/tests/productseries-views.txt 2010-09-10 13:32:47 +0000
@@ -25,17 +25,17 @@
2525
26 >>> from lp.app.enums import ServiceUsage26 >>> from lp.app.enums import ServiceUsage
27 >>> login_person(product.owner)27 >>> login_person(product.owner)
28 >>> product.official_answers = True28 >>> product.answers_usage = ServiceUsage.LAUNCHPAD
29 >>> product.official_blueprints = True29 >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
30 >>> product.official_malone = True30 >>> product.official_malone = True
31 >>> product.translations_usage = ServiceUsage.LAUNCHPAD31 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
32 >>> view = create_view(series, '+get-involved')32 >>> view = create_view(series, '+get-involved')
3333
34 # official_answers is always false for product series.34 # answers_usage is never LAUNCHPAD for product series.
35 >>> print view.official_answers35 >>> print view.answers_usage.name
36 False36 NOT_APPLICABLE
37 >>> print view.official_blueprints37 >>> print view.blueprints_usage.name
38 True38 LAUNCHPAD
39 >>> print view.official_malone39 >>> print view.official_malone
40 True40 True
41 >>> print view.translations_usage.name41 >>> print view.translations_usage.name
4242
=== 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-10 13:32:47 +0000
@@ -71,12 +71,14 @@
71The portlet are rendered when a child product officially uses the Launchpad71The portlet are rendered when a child product officially uses the Launchpad
72Answers, Blueprints, and Bugs applications.72Answers, Blueprints, and Bugs applications.
7373
74 >>> product.official_answers = True74 >>> from lp.app.enums import ServiceUsage
75 >>> product.official_blueprints = True75 >>> product.answers_usage = ServiceUsage.LAUNCHPAD
76 >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
76 >>> product.official_malone = True77 >>> product.official_malone = True
7778
78 >>> view = create_view(projectgroup, name='+index', principal=owner)79 >>> view = create_view(projectgroup, name='+index', principal=owner)
79 >>> content = find_tag_by_id(view.render(), 'maincontent')80 >>> content = find_tag_by_id(view.render(), 'maincontent')
81
80 >>> print find_tag_by_id(content, 'portlet-latest-faqs')['id']82 >>> print find_tag_by_id(content, 'portlet-latest-faqs')['id']
81 portlet-latest-faqs83 portlet-latest-faqs
82 >>> print find_tag_by_id(content, 'portlet-latest-questions')['id']84 >>> print find_tag_by_id(content, 'portlet-latest-questions')['id']
8385
=== modified file 'lib/lp/registry/doc/distribution.txt'
--- lib/lp/registry/doc/distribution.txt 2010-08-31 23:03:45 +0000
+++ lib/lp/registry/doc/distribution.txt 2010-09-10 13:32:47 +0000
@@ -392,12 +392,12 @@
392 >>> ubuntu = getUtility(ILaunchpadCelebrities).ubuntu392 >>> ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
393 >>> ubuntu.official_malone393 >>> ubuntu.official_malone
394 True394 True
395 >>> ubuntu.translations_usage.name395 >>> print ubuntu.answers_usage.name
396 'LAUNCHPAD'396 LAUNCHPAD
397 >>> ubuntu.official_answers397 >>> print ubuntu.blueprints_usage.name
398 True398 LAUNCHPAD
399 >>> ubuntu.official_blueprints399 >>> print ubuntu.translations_usage.name
400 True400 LAUNCHPAD
401401
402The bug_tracking_usage property currently only tracks official_malone.402The bug_tracking_usage property currently only tracks official_malone.
403403
@@ -462,11 +462,12 @@
462462
463Launchpad admins and the distro owner can set these fields.463Launchpad admins and the distro owner can set these fields.
464464
465 >>> from lp.app.enums import ServiceUsage
465 >>> login('mark@example.com')466 >>> login('mark@example.com')
466 >>> debian = getUtility(ILaunchpadCelebrities).debian467 >>> debian = getUtility(ILaunchpadCelebrities).debian
467 >>> debian.official_blueprints = True468 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
468 >>> debian.official_blueprints469 >>> print debian.blueprints_usage.name
469 True470 LAUNCHPAD
470 >>> debian.official_malone = True471 >>> debian.official_malone = True
471 >>> debian.official_malone472 >>> debian.official_malone
472 True473 True
@@ -477,16 +478,16 @@
477 >>> debian_owner = factory.makePerson()478 >>> debian_owner = factory.makePerson()
478 >>> debian.owner = debian_owner479 >>> debian.owner = debian_owner
479 >>> login_person(debian_owner)480 >>> login_person(debian_owner)
480 >>> debian.official_blueprints = False481 >>> debian.blueprints_usage = ServiceUsage.NOT_APPLICABLE
481 >>> debian.official_blueprints482 >>> print debian.blueprints_usage.name
482 False483 NOT_APPLICABLE
483484
484But others can't.485But others can't.
485486
486 >>> login('no-priv@canonical.com')487 >>> login('no-priv@canonical.com')
487 >>> debian.official_blueprints = True488 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
488 Traceback (most recent call last):489 Traceback (most recent call last):
489 Unauthorized: (..., 'official_blueprints', 'launchpad.Edit')490 Unauthorized: (..., 'blueprints_usage', 'launchpad.Edit')
490 >>> debian.official_malone = True491 >>> debian.official_malone = True
491 Traceback (most recent call last):492 Traceback (most recent call last):
492 Unauthorized: (..., 'official_malone', 'launchpad.Edit')493 Unauthorized: (..., 'official_malone', 'launchpad.Edit')
493494
=== modified file 'lib/lp/registry/doc/product.txt'
--- lib/lp/registry/doc/product.txt 2010-09-03 13:29:58 +0000
+++ lib/lp/registry/doc/product.txt 2010-09-10 13:32:47 +0000
@@ -316,14 +316,13 @@
316Firefox uses the Answer Tracker as the official application to provide316Firefox uses the Answer Tracker as the official application to provide
317answers to questions.317answers to questions.
318318
319 >>> firefox.official_answers319 >>> print firefox.answers_usage.name
320 True320 LAUNCHPAD
321321
322Alsa does not use Launchpad to track answers.322Alsa does not use Launchpad to track answers.
323323
324 >>> alsa.official_answers324 >>> print alsa.answers_usage.name
325 False325 UNKNOWN
326
327326
328Product Creation327Product Creation
329----------------328----------------
@@ -383,17 +382,18 @@
383----------------------382----------------------
384383
385We should be able to set whether or not a Product uses specifications384We should be able to set whether or not a Product uses specifications
386officially. It defaults to False.385officially. It defaults to UNKNOWN.
387386
388 >>> firefox = productset.getByName('firefox')387 >>> firefox = productset.getByName('firefox')
389 >>> firefox.official_blueprints388 >>> print firefox.blueprints_usage.name
390 False389 UNKNOWN
391390
392We can change it to True.391We can change it to use LAUNCHPAD.
393392
394 >>> firefox.official_blueprints = True393 >>> from lp.app.enums import ServiceUsage
395 >>> firefox.official_blueprints394 >>> firefox.blueprints_usage = ServiceUsage.LAUNCHPAD
396 True395 >>> print firefox.blueprints_usage.name
396 LAUNCHPAD
397397
398We should be able to get lists of specifications in different states398We should be able to get lists of specifications in different states
399related to a product.399related to a product.
400400
=== modified file 'lib/lp/registry/templates/distribution-index.pt'
--- lib/lp/registry/templates/distribution-index.pt 2010-08-24 20:11:37 +0000
+++ lib/lp/registry/templates/distribution-index.pt 2010-09-10 13:32:47 +0000
@@ -52,7 +52,7 @@
52 <div class="yui-g">52 <div class="yui-g">
53 <div class="yui-u first">53 <div class="yui-u first">
54 <div tal:replace="structure context/@@+portlet-listfaqs"54 <div tal:replace="structure context/@@+portlet-listfaqs"
55 tal:condition="context/official_answers" />55 tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
5656
57 <div tal:replace="structure context/@@+portlet-latestbugs"57 <div tal:replace="structure context/@@+portlet-latestbugs"
58 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />58 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />
@@ -62,10 +62,10 @@
6262
63 <div class="yui-u">63 <div class="yui-u">
64 <div tal:replace="structure context/@@+portlet-latestquestions"64 <div tal:replace="structure context/@@+portlet-latestquestions"
65 tal:condition="context/official_answers" />65 tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
6666
67 <div tal:replace="structure context/@@+portlet-latestspecs"67 <div tal:replace="structure context/@@+portlet-latestspecs"
68 tal:condition="context/official_blueprints" />68 tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
6969
70 <div tal:replace="structure context/@@+portlet-coming-sprints" />70 <div tal:replace="structure context/@@+portlet-coming-sprints" />
71 </div>71 </div>
7272
=== modified file 'lib/lp/registry/templates/distribution-search.pt'
--- lib/lp/registry/templates/distribution-search.pt 2010-08-24 20:11:37 +0000
+++ lib/lp/registry/templates/distribution-search.pt 2010-09-10 13:32:47 +0000
@@ -77,7 +77,7 @@
77 </a>77 </a>
78 <a78 <a
79 tal:define="link package/menu:answers/new"79 tal:define="link package/menu:answers/new"
80 tal:condition="distribution/official_answers"80 tal:condition="distribution/answers_usage/enumvalue:LAUNCHPAD"
81 tal:attributes="href link/url">81 tal:attributes="href link/url">
82 <img82 <img
83 tal:attributes="alt link/text"83 tal:attributes="alt link/text"
@@ -137,7 +137,7 @@
137 condition="binary_names"137 condition="binary_names"
138 content="string:(Matching binaries: ${binary_names}.)">138 content="string:(Matching binaries: ${binary_names}.)">
139 (Matching binaries: bin-one, bin-two.)139 (Matching binaries: bin-one, bin-two.)
140 </tal:matching-binaries> 140 </tal:matching-binaries>
141 </tal:binary-search-only>141 </tal:binary-search-only>
142 </p>142 </p>
143 </div>143 </div>
144144
=== modified file 'lib/lp/registry/templates/distroseries-index.pt'
--- lib/lp/registry/templates/distroseries-index.pt 2010-08-25 16:18:24 +0000
+++ lib/lp/registry/templates/distroseries-index.pt 2010-09-10 13:32:47 +0000
@@ -83,7 +83,8 @@
8383
84 <div84 <div
85 tal:content="structure context/@@+portlet-latestspecs"85 tal:content="structure context/@@+portlet-latestspecs"
86 tal:condition="context/@@+get-involved/official_blueprints" />86 tal:define="blueprints_usage context/@@+get-involved/blueprints_usage"
87 condition="blueprints_usage/enumvalue:LAUNCHPAD" />
8788
88 <div89 <div
89 tal:replace="structure context/distribution/@@+portlet-coming-sprints" />90 tal:replace="structure context/distribution/@@+portlet-coming-sprints" />
9091
=== modified file 'lib/lp/registry/templates/product-index.pt'
--- lib/lp/registry/templates/product-index.pt 2010-08-26 17:25:46 +0000
+++ lib/lp/registry/templates/product-index.pt 2010-09-10 13:32:47 +0000
@@ -215,7 +215,7 @@
215 <div class="yui-g">215 <div class="yui-g">
216 <div class="yui-u first">216 <div class="yui-u first">
217 <div tal:content="structure context/@@+portlet-listfaqs"217 <div tal:content="structure context/@@+portlet-listfaqs"
218 tal:condition="context/official_answers" />218 tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
219219
220 <div tal:content="structure context/@@+portlet-latestbugs"220 <div tal:content="structure context/@@+portlet-latestbugs"
221 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />221 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />
@@ -227,10 +227,10 @@
227227
228 <div class="yui-u">228 <div class="yui-u">
229 <div tal:content="structure context/@@+portlet-latestquestions"229 <div tal:content="structure context/@@+portlet-latestquestions"
230 tal:condition="context/official_answers" />230 tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
231231
232 <div tal:content="structure context/@@+portlet-latestspecs"232 <div tal:content="structure context/@@+portlet-latestspecs"
233 tal:condition="context/official_blueprints" />233 tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
234234
235 <div tal:content="structure context/@@+portlet-coming-sprints" />235 <div tal:content="structure context/@@+portlet-coming-sprints" />
236 </div>236 </div>
237237
=== modified file 'lib/lp/registry/templates/productseries-index.pt'
--- lib/lp/registry/templates/productseries-index.pt 2010-08-25 15:24:48 +0000
+++ lib/lp/registry/templates/productseries-index.pt 2010-09-10 13:32:47 +0000
@@ -145,7 +145,7 @@
145 <div class="yui-u">145 <div class="yui-u">
146 <div146 <div
147 tal:content="structure context/@@+portlet-latestspecs"147 tal:content="structure context/@@+portlet-latestspecs"
148 tal:condition="context/@@+get-involved/official_blueprints" />148 tal:condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
149149
150 <div tal:replace="structure context/product/@@+portlet-coming-sprints" />150 <div tal:replace="structure context/product/@@+portlet-coming-sprints" />
151151
152152
=== modified file 'lib/lp/registry/templates/project-index.pt'
--- lib/lp/registry/templates/project-index.pt 2010-08-25 15:37:37 +0000
+++ lib/lp/registry/templates/project-index.pt 2010-09-10 13:32:47 +0000
@@ -72,11 +72,11 @@
72 <tal:details replace="structure context/@@+details" />72 <tal:details replace="structure context/@@+details" />
7373
74 <tal:faqs content="structure context/@@+portlet-listfaqs"74 <tal:faqs content="structure context/@@+portlet-listfaqs"
75 condition="context/@@+get-involved/official_answers" />75 condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
7676
77 <tal:has-many-project condition="view/has_many_projects">77 <tal:has-many-project condition="view/has_many_projects">
78 <tal:questions content="structure context/@@+portlet-latestquestions"78 <tal:questions content="structure context/@@+portlet-latestquestions"
79 condition="context/@@+get-involved/official_answers" />79 condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
80 </tal:has-many-project>80 </tal:has-many-project>
8181
82 <tal:bugs content="structure context/@@+portlet-latestbugs"82 <tal:bugs content="structure context/@@+portlet-latestbugs"
@@ -84,7 +84,7 @@
8484
85 <tal:has-many-project condition="view/has_many_projects">85 <tal:has-many-project condition="view/has_many_projects">
86 <tal:specs content="structure context/@@+portlet-latestspecs"86 <tal:specs content="structure context/@@+portlet-latestspecs"
87 condition="context/@@+get-involved/official_blueprints" />87 condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
88 </tal:has-many-project>88 </tal:has-many-project>
8989
90 <tal:contributors content="structure context/@@+portlet-top-contributors"/>90 <tal:contributors content="structure context/@@+portlet-top-contributors"/>
@@ -119,10 +119,10 @@
119119
120 <tal:has-few-project condition="not: view/has_many_projects">120 <tal:has-few-project condition="not: view/has_many_projects">
121 <tal:questions content="structure context/@@+portlet-latestquestions"121 <tal:questions content="structure context/@@+portlet-latestquestions"
122 condition="context/@@+get-involved/official_answers" />122 condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
123123
124 <tal:specs content="structure context/@@+portlet-latestspecs"124 <tal:specs content="structure context/@@+portlet-latestspecs"
125 condition="context/@@+get-involved/official_blueprints" />125 condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
126126
127 <tal:sprints content="structure context/@@+portlet-coming-sprints" />127 <tal:sprints content="structure context/@@+portlet-coming-sprints" />
128 </tal:has-few-project>128 </tal:has-few-project>