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
1=== modified file 'lib/lp/answers/browser/questiontarget.py'
2--- lib/lp/answers/browser/questiontarget.py 2010-08-31 11:31:04 +0000
3+++ lib/lp/answers/browser/questiontarget.py 2010-09-10 13:32:47 +0000
4@@ -78,6 +78,7 @@
5 IQuestionTarget,
6 ISearchQuestionsForm,
7 )
8+from lp.app.enums import service_uses_launchpad
9 from lp.app.errors import NotFoundError
10 from lp.registry.interfaces.distribution import IDistribution
11 from lp.registry.interfaces.product import IProduct
12@@ -204,7 +205,7 @@
13 return self.default_template
14 involvement = getMultiAdapter(
15 (self.context, self.request), name='+get-involved')
16- if involvement.official_answers:
17+ if service_uses_launchpad(involvement.answers_usage):
18 # Primary contexts that officially use answers have a
19 # search and listing presentation.
20 return self.default_template
21
22=== modified file 'lib/lp/answers/doc/question.txt'
23--- lib/lp/answers/doc/question.txt 2010-07-28 16:56:05 +0000
24+++ lib/lp/answers/doc/question.txt 2010-09-10 13:32:47 +0000
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+ >>> print ubuntu.answers_usage.name
38+ LAUNCHPAD
39+ >>> print firefox.answers_usage.name
40+ LAUNCHPAD
41
42
43 IQuestion interface
44
45=== modified file 'lib/lp/answers/doc/questionsets.txt'
46--- lib/lp/answers/doc/questionsets.txt 2010-07-27 17:18:24 +0000
47+++ lib/lp/answers/doc/questionsets.txt 2010-09-10 13:32:47 +0000
48@@ -208,14 +208,14 @@
49 order of the returned projects is based on the number of questions asked
50 during the period.
51
52- >>> ubuntu.official_answers
53- True
54- >>> firefox.official_answers
55- True
56- >>> landscape.official_answers
57- False
58- >>> launchpad.official_answers
59- True
60+ >>> print ubuntu.answers_usage.name
61+ LAUNCHPAD
62+ >>> print firefox.answers_usage.name
63+ LAUNCHPAD
64+ >>> print landscape.answers_usage.name
65+ UNKNOWN
66+ >>> print launchpad.answers_usage.name
67+ LAUNCHPAD
68
69 # Launchpad is not returned because the question was not asked in
70 # the last 60 days.
71
72=== modified file 'lib/lp/registry/browser/distribution.py'
73--- lib/lp/registry/browser/distribution.py 2010-09-03 13:29:58 +0000
74+++ lib/lp/registry/browser/distribution.py 2010-09-10 13:32:47 +0000
75@@ -123,10 +123,10 @@
76 """Return a string of LP apps (comma-separated) this distro uses."""
77 uses = []
78 href_template = """<a href="%s">%s</a>"""
79- if self.context.official_answers:
80+ if service_uses_launchpad(self.context.answers_usage):
81 url = canonical_url(self.context, rootsite='answers')
82 uses.append(href_template % (url, 'Answers'))
83- if self.context.official_blueprints:
84+ if service_uses_launchpad(self.context.blueprints_usage):
85 url = canonical_url(self.context, rootsite='blueprints')
86 uses.append(href_template % (url, 'Blueprints'))
87 if self.context.official_malone:
88
89=== modified file 'lib/lp/registry/browser/pillar.py'
90--- lib/lp/registry/browser/pillar.py 2010-09-03 13:29:58 +0000
91+++ lib/lp/registry/browser/pillar.py 2010-09-10 13:32:47 +0000
92@@ -70,7 +70,7 @@
93 def ask_question(self):
94 return Link(
95 '+addquestion', 'Ask a question', site='answers', icon='answers',
96- enabled=self.pillar.official_answers)
97+ enabled=service_uses_launchpad(self.pillar.answers_usage))
98
99 def help_translate(self):
100 return Link(
101@@ -91,8 +91,11 @@
102
103 def register_blueprint(self):
104 return Link(
105- '+addspec', 'Register a blueprint', site='blueprints',
106- icon='blueprints', enabled=self.pillar.official_blueprints)
107+ '+addspec',
108+ 'Register a blueprint',
109+ site='blueprints',
110+ icon='blueprints',
111+ enabled=service_uses_launchpad(self.pillar.blueprints_usage))
112
113
114 class PillarView(LaunchpadView):
115@@ -105,8 +108,8 @@
116 def __init__(self, context, request):
117 super(PillarView, self).__init__(context, request)
118 self.official_malone = False
119- self.official_answers = False
120- self.official_blueprints = False
121+ self.answers_usage = ServiceUsage.UNKNOWN
122+ self.blueprints_usage = ServiceUsage.UNKNOWN
123 self.translations_usage = ServiceUsage.UNKNOWN
124 self.codehosting_usage = ServiceUsage.UNKNOWN
125 pillar = nearest(self.context, IPillar)
126@@ -119,11 +122,11 @@
127 else:
128 self._set_official_launchpad(pillar)
129 if IDistroSeries.providedBy(self.context):
130- self.official_answers = False
131 distribution = self.context.distribution
132 self.codehosting_usage = distribution.codehosting_usage
133+ self.answers_usage = ServiceUsage.NOT_APPLICABLE
134 elif IDistributionSourcePackage.providedBy(self.context):
135- self.official_blueprints = False
136+ self.blueprints_usage = ServiceUsage.UNKNOWN
137 self.translations_usage = ServiceUsage.UNKNOWN
138 else:
139 # The context is used by all apps.
140@@ -135,19 +138,21 @@
141 # times to build the complete set of official applications.
142 if pillar.official_malone:
143 self.official_malone = True
144- if pillar.official_answers:
145- self.official_answers = True
146- if pillar.official_blueprints:
147- self.official_blueprints = True
148- self.translations_usage = IServiceUsage(pillar).translations_usage
149- self.codehosting_usage = IServiceUsage(pillar).codehosting_usage
150+ if service_uses_launchpad(IServiceUsage(pillar).answers_usage):
151+ self.answers_usage = ServiceUsage.LAUNCHPAD
152+ if service_uses_launchpad(IServiceUsage(pillar).blueprints_usage):
153+ self.blueprints_usage = ServiceUsage.LAUNCHPAD
154+ if service_uses_launchpad(pillar.translations_usage):
155+ self.translations_usage = ServiceUsage.LAUNCHPAD
156+ if service_uses_launchpad(IServiceUsage(pillar).codehosting_usage):
157+ self.codehosting_usage = ServiceUsage.LAUNCHPAD
158
159 @property
160 def has_involvement(self):
161 """This `IPillar` uses Launchpad."""
162- return (
163- self.official_malone or self.official_answers
164- or self.official_blueprints
165+ return (self.official_malone
166+ or service_uses_launchpad(self.answers_usage)
167+ or service_uses_launchpad(self.blueprints_usage)
168 or service_uses_launchpad(self.translations_usage)
169 or service_uses_launchpad(self.codehosting_usage))
170
171
172=== modified file 'lib/lp/registry/browser/productseries.py'
173--- lib/lp/registry/browser/productseries.py 2010-09-03 15:02:39 +0000
174+++ lib/lp/registry/browser/productseries.py 2010-09-10 13:32:47 +0000
175@@ -254,11 +254,11 @@
176
177 def __init__(self, context, request):
178 super(ProductSeriesInvolvementView, self).__init__(context, request)
179+ self.answers_usage = ServiceUsage.NOT_APPLICABLE
180 if self.context.branch is not None:
181 self.codehosting_usage = ServiceUsage.LAUNCHPAD
182 else:
183 self.codehosting_usage = ServiceUsage.UNKNOWN
184- self.official_answers = False
185
186 @property
187 def configuration_links(self):
188
189=== modified file 'lib/lp/registry/browser/tests/distribution-views.txt'
190--- lib/lp/registry/browser/tests/distribution-views.txt 2010-08-30 18:26:19 +0000
191+++ lib/lp/registry/browser/tests/distribution-views.txt 2010-09-10 13:32:47 +0000
192@@ -274,11 +274,12 @@
193 If the distribution officially uses the application, its portlet does appear.
194
195 >>> from canonical.testing.layers import MemcachedLayer
196+ >>> from lp.app.enums import ServiceUsage
197
198 # When the cache regenerated, all users will see the change.
199 >>> MemcachedLayer.purge()
200- >>> distribution.official_answers = True
201- >>> distribution.official_blueprints = True
202+ >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
203+ >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
204 >>> distribution.official_malone = True
205
206 >>> view = create_view(distribution, name='+index', principal=owner)
207
208=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
209--- lib/lp/registry/browser/tests/pillar-views.txt 2010-09-01 22:59:30 +0000
210+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-09-10 13:32:47 +0000
211@@ -24,7 +24,8 @@
212
213 Pillars that do use launchpad applications have an involvement menu.
214
215- >>> distribution.official_answers = True
216+ >>> from lp.app.enums import ServiceUsage
217+ >>> distribution.answers_usage = ServiceUsage.LAUNCHPAD
218 >>> distribution.official_malone = True
219 >>> view = create_view(
220 ... distribution, '+get-involved', principal=distribution.owner)
221@@ -33,14 +34,14 @@
222
223 >>> view.official_malone
224 True
225- >>> view.official_answers
226- True
227+ >>> print view.answers_usage.name
228+ LAUNCHPAD
229 >>> view.translations_usage.name
230 'UNKNOWN'
231- >>> view.official_blueprints
232- False
233- >>> view.codehosting_usage.name
234- 'NOT_APPLICABLE'
235+ >>> print view.blueprints_usage.name
236+ UNKNOWN
237+ >>> print view.codehosting_usage.name
238+ UNKNOWN
239
240 The view provides a list of enabled links that is rendered by the template.
241
242@@ -65,10 +66,10 @@
243
244 >>> product = factory.makeProduct(name='bread')
245 >>> login_person(product.owner)
246- >>> product.official_blueprints = True
247+ >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
248 >>> view = create_view(product, '+get-involved')
249- >>> view.official_blueprints
250- True
251+ >>> print view.blueprints_usage.name
252+ LAUNCHPAD
253 >>> for link in view.enabled_links:
254 ... print link.name
255 register_blueprint
256@@ -114,7 +115,6 @@
257
258 Changing the product's usage is reflected in the view properties.
259
260- >>> from lp.app.enums import ServiceUsage
261 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
262 >>> view = create_view(product, '+get-involved')
263 >>> for key in sorted(view.configuration_states.keys()):
264@@ -189,8 +189,8 @@
265 >>> product.project = project_group
266
267 >>> view = create_view(project_group, '+get-involved')
268- >>> view.official_blueprints
269- True
270+ >>> print view.blueprints_usage.name
271+ LAUNCHPAD
272
273 The offical_codehosting for a project is based on whether the project's
274 development focus series has a branch.
275@@ -200,23 +200,23 @@
276 >>> product.official_codehosting
277 False
278 >>> view = create_view(product, '+get-involved')
279- >>> view.codehosting_usage.name
280- 'UNKNOWN'
281+ >>> print view.codehosting_usage.name
282+ UNKNOWN
283
284 >>> product.development_focus.branch = factory.makeBranch(
285 ... product=product)
286 >>> product.official_codehosting
287 True
288 >>> view = create_view(product, '+get-involved')
289- >>> view.codehosting_usage.name
290- 'LAUNCHPAD'
291+ >>> print view.codehosting_usage.name
292+ LAUNCHPAD
293
294 Project groups cannot make links to register a branch, so
295 official_codehosting is always false.
296
297 >>> view = create_view(project_group, '+get-involved')
298- >>> view.codehosting_usage.name
299- 'NOT_APPLICABLE'
300+ >>> print view.codehosting_usage.name
301+ NOT_APPLICABLE
302
303 DistroSeries can use this view. The distribution is used to set the links.
304
305@@ -232,7 +232,7 @@
306
307 >>> from lp.app.enums import ServiceUsage
308 >>> login_person(distribution.owner)
309- >>> distribution.official_blueprints = True
310+ >>> distribution.blueprints_usage = ServiceUsage.LAUNCHPAD
311 >>> distribution.translations_usage = ServiceUsage.LAUNCHPAD
312 >>> package = factory.makeDistributionSourcePackage(
313 ... sourcepackagename="box",
314
315=== modified file 'lib/lp/registry/browser/tests/product-views.txt'
316--- lib/lp/registry/browser/tests/product-views.txt 2010-08-16 19:28:37 +0000
317+++ lib/lp/registry/browser/tests/product-views.txt 2010-09-10 13:32:47 +0000
318@@ -482,8 +482,9 @@
319 The portlet are rendered when a product officially uses the Launchpad
320 Answers, Blueprints, and Bugs applications.
321
322- >>> product.official_answers = True
323- >>> product.official_blueprints = True
324+ >>> from lp.app.enums import ServiceUsage
325+ >>> product.answers_usage = ServiceUsage.LAUNCHPAD
326+ >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
327 >>> product.official_malone = True
328
329 >>> view = create_initialized_view(
330
331=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
332--- lib/lp/registry/browser/tests/productseries-views.txt 2010-09-09 15:26:11 +0000
333+++ lib/lp/registry/browser/tests/productseries-views.txt 2010-09-10 13:32:47 +0000
334@@ -25,17 +25,17 @@
335
336 >>> from lp.app.enums import ServiceUsage
337 >>> login_person(product.owner)
338- >>> product.official_answers = True
339- >>> product.official_blueprints = True
340+ >>> product.answers_usage = ServiceUsage.LAUNCHPAD
341+ >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
342 >>> product.official_malone = True
343 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
344 >>> view = create_view(series, '+get-involved')
345
346- # official_answers is always false for product series.
347- >>> print view.official_answers
348- False
349- >>> print view.official_blueprints
350- True
351+ # answers_usage is never LAUNCHPAD for product series.
352+ >>> print view.answers_usage.name
353+ NOT_APPLICABLE
354+ >>> print view.blueprints_usage.name
355+ LAUNCHPAD
356 >>> print view.official_malone
357 True
358 >>> print view.translations_usage.name
359
360=== modified file 'lib/lp/registry/browser/tests/projectgroup-views.txt'
361--- lib/lp/registry/browser/tests/projectgroup-views.txt 2009-08-31 20:46:06 +0000
362+++ lib/lp/registry/browser/tests/projectgroup-views.txt 2010-09-10 13:32:47 +0000
363@@ -71,12 +71,14 @@
364 The portlet are rendered when a child product officially uses the Launchpad
365 Answers, Blueprints, and Bugs applications.
366
367- >>> product.official_answers = True
368- >>> product.official_blueprints = True
369+ >>> from lp.app.enums import ServiceUsage
370+ >>> product.answers_usage = ServiceUsage.LAUNCHPAD
371+ >>> product.blueprints_usage = ServiceUsage.LAUNCHPAD
372 >>> product.official_malone = True
373
374 >>> view = create_view(projectgroup, name='+index', principal=owner)
375 >>> content = find_tag_by_id(view.render(), 'maincontent')
376+
377 >>> print find_tag_by_id(content, 'portlet-latest-faqs')['id']
378 portlet-latest-faqs
379 >>> print find_tag_by_id(content, 'portlet-latest-questions')['id']
380
381=== modified file 'lib/lp/registry/doc/distribution.txt'
382--- lib/lp/registry/doc/distribution.txt 2010-08-31 23:03:45 +0000
383+++ lib/lp/registry/doc/distribution.txt 2010-09-10 13:32:47 +0000
384@@ -392,12 +392,12 @@
385 >>> ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
386 >>> ubuntu.official_malone
387 True
388- >>> ubuntu.translations_usage.name
389- 'LAUNCHPAD'
390- >>> ubuntu.official_answers
391- True
392- >>> ubuntu.official_blueprints
393- True
394+ >>> print ubuntu.answers_usage.name
395+ LAUNCHPAD
396+ >>> print ubuntu.blueprints_usage.name
397+ LAUNCHPAD
398+ >>> print ubuntu.translations_usage.name
399+ LAUNCHPAD
400
401 The bug_tracking_usage property currently only tracks official_malone.
402
403@@ -462,11 +462,12 @@
404
405 Launchpad admins and the distro owner can set these fields.
406
407+ >>> from lp.app.enums import ServiceUsage
408 >>> login('mark@example.com')
409 >>> debian = getUtility(ILaunchpadCelebrities).debian
410- >>> debian.official_blueprints = True
411- >>> debian.official_blueprints
412- True
413+ >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
414+ >>> print debian.blueprints_usage.name
415+ LAUNCHPAD
416 >>> debian.official_malone = True
417 >>> debian.official_malone
418 True
419@@ -477,16 +478,16 @@
420 >>> debian_owner = factory.makePerson()
421 >>> debian.owner = debian_owner
422 >>> login_person(debian_owner)
423- >>> debian.official_blueprints = False
424- >>> debian.official_blueprints
425- False
426+ >>> debian.blueprints_usage = ServiceUsage.NOT_APPLICABLE
427+ >>> print debian.blueprints_usage.name
428+ NOT_APPLICABLE
429
430 But others can't.
431
432 >>> login('no-priv@canonical.com')
433- >>> debian.official_blueprints = True
434+ >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
435 Traceback (most recent call last):
436- Unauthorized: (..., 'official_blueprints', 'launchpad.Edit')
437+ Unauthorized: (..., 'blueprints_usage', 'launchpad.Edit')
438 >>> debian.official_malone = True
439 Traceback (most recent call last):
440 Unauthorized: (..., 'official_malone', 'launchpad.Edit')
441
442=== modified file 'lib/lp/registry/doc/product.txt'
443--- lib/lp/registry/doc/product.txt 2010-09-03 13:29:58 +0000
444+++ lib/lp/registry/doc/product.txt 2010-09-10 13:32:47 +0000
445@@ -316,14 +316,13 @@
446 Firefox uses the Answer Tracker as the official application to provide
447 answers to questions.
448
449- >>> firefox.official_answers
450- True
451+ >>> print firefox.answers_usage.name
452+ LAUNCHPAD
453
454 Alsa does not use Launchpad to track answers.
455
456- >>> alsa.official_answers
457- False
458-
459+ >>> print alsa.answers_usage.name
460+ UNKNOWN
461
462 Product Creation
463 ----------------
464@@ -383,17 +382,18 @@
465 ----------------------
466
467 We should be able to set whether or not a Product uses specifications
468-officially. It defaults to False.
469+officially. It defaults to UNKNOWN.
470
471 >>> firefox = productset.getByName('firefox')
472- >>> firefox.official_blueprints
473- False
474-
475-We can change it to True.
476-
477- >>> firefox.official_blueprints = True
478- >>> firefox.official_blueprints
479- True
480+ >>> print firefox.blueprints_usage.name
481+ UNKNOWN
482+
483+We can change it to use LAUNCHPAD.
484+
485+ >>> from lp.app.enums import ServiceUsage
486+ >>> firefox.blueprints_usage = ServiceUsage.LAUNCHPAD
487+ >>> print firefox.blueprints_usage.name
488+ LAUNCHPAD
489
490 We should be able to get lists of specifications in different states
491 related to a product.
492
493=== modified file 'lib/lp/registry/templates/distribution-index.pt'
494--- lib/lp/registry/templates/distribution-index.pt 2010-08-24 20:11:37 +0000
495+++ lib/lp/registry/templates/distribution-index.pt 2010-09-10 13:32:47 +0000
496@@ -52,7 +52,7 @@
497 <div class="yui-g">
498 <div class="yui-u first">
499 <div tal:replace="structure context/@@+portlet-listfaqs"
500- tal:condition="context/official_answers" />
501+ tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
502
503 <div tal:replace="structure context/@@+portlet-latestbugs"
504 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />
505@@ -62,10 +62,10 @@
506
507 <div class="yui-u">
508 <div tal:replace="structure context/@@+portlet-latestquestions"
509- tal:condition="context/official_answers" />
510+ tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
511
512 <div tal:replace="structure context/@@+portlet-latestspecs"
513- tal:condition="context/official_blueprints" />
514+ tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
515
516 <div tal:replace="structure context/@@+portlet-coming-sprints" />
517 </div>
518
519=== modified file 'lib/lp/registry/templates/distribution-search.pt'
520--- lib/lp/registry/templates/distribution-search.pt 2010-08-24 20:11:37 +0000
521+++ lib/lp/registry/templates/distribution-search.pt 2010-09-10 13:32:47 +0000
522@@ -77,7 +77,7 @@
523 </a>
524 <a
525 tal:define="link package/menu:answers/new"
526- tal:condition="distribution/official_answers"
527+ tal:condition="distribution/answers_usage/enumvalue:LAUNCHPAD"
528 tal:attributes="href link/url">
529 <img
530 tal:attributes="alt link/text"
531@@ -137,7 +137,7 @@
532 condition="binary_names"
533 content="string:(Matching binaries: ${binary_names}.)">
534 (Matching binaries: bin-one, bin-two.)
535- </tal:matching-binaries>
536+ </tal:matching-binaries>
537 </tal:binary-search-only>
538 </p>
539 </div>
540
541=== modified file 'lib/lp/registry/templates/distroseries-index.pt'
542--- lib/lp/registry/templates/distroseries-index.pt 2010-08-25 16:18:24 +0000
543+++ lib/lp/registry/templates/distroseries-index.pt 2010-09-10 13:32:47 +0000
544@@ -83,7 +83,8 @@
545
546 <div
547 tal:content="structure context/@@+portlet-latestspecs"
548- tal:condition="context/@@+get-involved/official_blueprints" />
549+ tal:define="blueprints_usage context/@@+get-involved/blueprints_usage"
550+ condition="blueprints_usage/enumvalue:LAUNCHPAD" />
551
552 <div
553 tal:replace="structure context/distribution/@@+portlet-coming-sprints" />
554
555=== modified file 'lib/lp/registry/templates/product-index.pt'
556--- lib/lp/registry/templates/product-index.pt 2010-08-26 17:25:46 +0000
557+++ lib/lp/registry/templates/product-index.pt 2010-09-10 13:32:47 +0000
558@@ -215,7 +215,7 @@
559 <div class="yui-g">
560 <div class="yui-u first">
561 <div tal:content="structure context/@@+portlet-listfaqs"
562- tal:condition="context/official_answers" />
563+ tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
564
565 <div tal:content="structure context/@@+portlet-latestbugs"
566 tal:condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD" />
567@@ -227,10 +227,10 @@
568
569 <div class="yui-u">
570 <div tal:content="structure context/@@+portlet-latestquestions"
571- tal:condition="context/official_answers" />
572+ tal:condition="context/answers_usage/enumvalue:LAUNCHPAD" />
573
574 <div tal:content="structure context/@@+portlet-latestspecs"
575- tal:condition="context/official_blueprints" />
576+ tal:condition="context/blueprints_usage/enumvalue:LAUNCHPAD" />
577
578 <div tal:content="structure context/@@+portlet-coming-sprints" />
579 </div>
580
581=== modified file 'lib/lp/registry/templates/productseries-index.pt'
582--- lib/lp/registry/templates/productseries-index.pt 2010-08-25 15:24:48 +0000
583+++ lib/lp/registry/templates/productseries-index.pt 2010-09-10 13:32:47 +0000
584@@ -145,7 +145,7 @@
585 <div class="yui-u">
586 <div
587 tal:content="structure context/@@+portlet-latestspecs"
588- tal:condition="context/@@+get-involved/official_blueprints" />
589+ tal:condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
590
591 <div tal:replace="structure context/product/@@+portlet-coming-sprints" />
592
593
594=== modified file 'lib/lp/registry/templates/project-index.pt'
595--- lib/lp/registry/templates/project-index.pt 2010-08-25 15:37:37 +0000
596+++ lib/lp/registry/templates/project-index.pt 2010-09-10 13:32:47 +0000
597@@ -72,11 +72,11 @@
598 <tal:details replace="structure context/@@+details" />
599
600 <tal:faqs content="structure context/@@+portlet-listfaqs"
601- condition="context/@@+get-involved/official_answers" />
602+ condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
603
604 <tal:has-many-project condition="view/has_many_projects">
605 <tal:questions content="structure context/@@+portlet-latestquestions"
606- condition="context/@@+get-involved/official_answers" />
607+ condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
608 </tal:has-many-project>
609
610 <tal:bugs content="structure context/@@+portlet-latestbugs"
611@@ -84,7 +84,7 @@
612
613 <tal:has-many-project condition="view/has_many_projects">
614 <tal:specs content="structure context/@@+portlet-latestspecs"
615- condition="context/@@+get-involved/official_blueprints" />
616+ condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
617 </tal:has-many-project>
618
619 <tal:contributors content="structure context/@@+portlet-top-contributors"/>
620@@ -119,10 +119,10 @@
621
622 <tal:has-few-project condition="not: view/has_many_projects">
623 <tal:questions content="structure context/@@+portlet-latestquestions"
624- condition="context/@@+get-involved/official_answers" />
625+ condition="context/@@+get-involved/answers_usage/enumvalue:LAUNCHPAD" />
626
627 <tal:specs content="structure context/@@+portlet-latestspecs"
628- condition="context/@@+get-involved/official_blueprints" />
629+ condition="context/@@+get-involved/blueprints_usage/enumvalue:LAUNCHPAD" />
630
631 <tal:sprints content="structure context/@@+portlet-coming-sprints" />
632 </tal:has-few-project>