Merge lp:~wgrant/launchpad/kill-excessive-facets into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 16942
Proposed branch: lp:~wgrant/launchpad/kill-excessive-facets
Merge into: lp:launchpad
Diff against target: 499 lines (+10/-180)
16 files modified
lib/lp/blueprints/browser/configure.zcml (+0/-1)
lib/lp/blueprints/browser/sprint.py (+0/-8)
lib/lp/bugs/browser/bug.py (+4/-2)
lib/lp/buildmaster/browser/builder.py (+0/-17)
lib/lp/buildmaster/browser/configure.zcml (+2/-6)
lib/lp/registry/browser/configure.zcml (+0/-2)
lib/lp/registry/browser/distribution.py (+0/-8)
lib/lp/registry/browser/product.py (+0/-9)
lib/lp/services/statistics/browser/launchpadstatistic.py (+1/-16)
lib/lp/soyuz/browser/build.py (+0/-9)
lib/lp/soyuz/browser/configure.zcml (+0/-4)
lib/lp/soyuz/browser/distroseriesbinarypackage.py (+0/-10)
lib/lp/translations/browser/configure.zcml (+3/-9)
lib/lp/translations/browser/pofile.py (+0/-9)
lib/lp/translations/browser/potemplate.py (+0/-61)
lib/lp/translations/browser/translationmessage.py (+0/-9)
To merge this branch: bzr merge lp:~wgrant/launchpad/kill-excessive-facets
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+208265@code.launchpad.net

Commit message

Drop pointless facet menu overrides -- they should mostly only exist on structural objects nowadays, so subordinate objects fall back to the object named in the watermark title.

Description of the change

Drop pointless facet menu overrides -- they should mostly only exist on structural objects nowadays, so subordinate objects fall back to the object named in the watermark title. This fixes various bugs about erroneously disabled tabs (eg. for Builder, BuilderSet, ProductSet), and removes a lot of useless code (eg. POTemplateFacets and the other translations bits were deleted with no functional change whatsoever).

The only modification to existing working functionality is that ProductSet's Code facet link no longer links to the project cloud, but rather to the global Code homepage. There was a bug filed about that inconsistency, so this seems like a net improvement.

The remaining IFacetMenus after this branch are StandardLaunchpadFacets, LaunchpadRootFacets, DistributionFacets, DistroSeriesFacets, DistributionSourcePackageFacets, SourcePackageFacets, PersonFacets, PersonProductFacets, ProductFacets, ProductSeriesFacets, SprintFacets and BugFacets. They're all structural objects except for PersonProduct, Sprint and Bug, but the first two are justified by how special they are, and Bug is necessary because it has no parent context without a BugTask (bug #182281).

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/browser/configure.zcml'
2--- lib/lp/blueprints/browser/configure.zcml 2014-02-19 00:35:25 +0000
3+++ lib/lp/blueprints/browser/configure.zcml 2014-02-26 03:55:49 +0000
4@@ -182,7 +182,6 @@
5 classes="
6 SprintFacets
7 SprintOverviewMenu
8- SprintSetFacets
9 SprintSetNavigationMenu
10 SprintSpecificationsMenu
11 "
12
13=== modified file 'lib/lp/blueprints/browser/sprint.py'
14--- lib/lp/blueprints/browser/sprint.py 2013-04-16 01:18:10 +0000
15+++ lib/lp/blueprints/browser/sprint.py 2014-02-26 03:55:49 +0000
16@@ -15,7 +15,6 @@
17 'SprintNavigation',
18 'SprintOverviewMenu',
19 'SprintSetBreadcrumb',
20- 'SprintSetFacets',
21 'SprintSetNavigation',
22 'SprintSetView',
23 'SprintSpecificationsMenu',
24@@ -157,13 +156,6 @@
25 text = 'Meetings'
26
27
28-class SprintSetFacets(StandardLaunchpadFacets):
29- """The facet menu for an ISprintSet."""
30-
31- usedfor = ISprintSet
32- enable_only = ['overview', ]
33-
34-
35 class HasSprintsView(LaunchpadView):
36
37 page_title = 'Events'
38
39=== modified file 'lib/lp/bugs/browser/bug.py'
40--- lib/lp/bugs/browser/bug.py 2013-10-14 05:27:40 +0000
41+++ lib/lp/bugs/browser/bug.py 2014-02-26 03:55:49 +0000
42@@ -200,8 +200,10 @@
43 class BugFacets(StandardLaunchpadFacets):
44 """The links that will appear in the facet menu for an `IBug`.
45
46- However, we never show this, but it does apply to things like
47- bug nominations, by 'acquisition'.
48+ This is rarely seen, as most bug views are actually on BugTask. But
49+ it's inherited by views on objects subordinate to the Bug itself,
50+ eg. nominations and attachments, where we don't have a pillar
51+ context to switch within.
52 """
53
54 usedfor = IBug
55
56=== modified file 'lib/lp/buildmaster/browser/builder.py'
57--- lib/lp/buildmaster/browser/builder.py 2013-12-03 09:52:27 +0000
58+++ lib/lp/buildmaster/browser/builder.py 2014-02-26 03:55:49 +0000
59@@ -6,12 +6,10 @@
60 __metaclass__ = type
61
62 __all__ = [
63- 'BuilderFacets',
64 'BuilderOverviewMenu',
65 'BuilderNavigation',
66 'BuilderSetAddView',
67 'BuilderSetBreadcrumb',
68- 'BuilderSetFacets',
69 'BuilderSetOverviewMenu',
70 'BuilderSetNavigation',
71 'BuilderSetView',
72@@ -54,7 +52,6 @@
73 LaunchpadView,
74 Link,
75 Navigation,
76- StandardLaunchpadFacets,
77 stepthrough,
78 )
79 from lp.services.webapp.batching import StormRangeFactory
80@@ -88,20 +85,6 @@
81 usedfor = IBuilder
82
83
84-class BuilderSetFacets(StandardLaunchpadFacets):
85- """The links that will appear in the facet menu for an IBuilderSet."""
86- enable_only = ['overview']
87-
88- usedfor = IBuilderSet
89-
90-
91-class BuilderFacets(StandardLaunchpadFacets):
92- """The links that will appear in the facet menu for an IBuilder."""
93- enable_only = ['overview']
94-
95- usedfor = IBuilder
96-
97-
98 class BuilderSetOverviewMenu(ApplicationMenu):
99 """Overview Menu for IBuilderSet."""
100 usedfor = IBuilderSet
101
102=== modified file 'lib/lp/buildmaster/browser/configure.zcml'
103--- lib/lp/buildmaster/browser/configure.zcml 2013-11-15 06:36:55 +0000
104+++ lib/lp/buildmaster/browser/configure.zcml 2014-02-26 03:55:49 +0000
105@@ -88,13 +88,9 @@
106 permission="launchpad.Edit"
107 template="../templates/builder-edit.pt"/>
108 <browser:menus
109- classes="
110- BuilderSetFacets
111- BuilderSetOverviewMenu"
112+ classes="BuilderSetOverviewMenu"
113 module="lp.buildmaster.browser.builder"/>
114 <browser:menus
115- classes="
116- BuilderFacets
117- BuilderOverviewMenu"
118+ classes="BuilderOverviewMenu"
119 module="lp.buildmaster.browser.builder"/>
120 </configure>
121
122=== modified file 'lib/lp/registry/browser/configure.zcml'
123--- lib/lp/registry/browser/configure.zcml 2014-02-25 06:42:01 +0000
124+++ lib/lp/registry/browser/configure.zcml 2014-02-26 03:55:49 +0000
125@@ -1594,7 +1594,6 @@
126 ProductFacets
127 ProductNavigationMenu
128 ProductOverviewMenu
129- ProductSetFacets
130 ProductSetNavigationMenu
131 ProductSpecificationsMenu
132 "
133@@ -1949,7 +1948,6 @@
134 DistributionOverviewMenu
135 DistributionSetActionNavigationMenu
136 DistributionSetContextMenu
137- DistributionSetFacets
138 DistributionSpecificationsMenu
139 "
140 module="lp.registry.browser.distribution"/>
141
142=== modified file 'lib/lp/registry/browser/distribution.py'
143--- lib/lp/registry/browser/distribution.py 2013-09-18 06:34:44 +0000
144+++ lib/lp/registry/browser/distribution.py 2014-02-26 03:55:49 +0000
145@@ -30,7 +30,6 @@
146 'DistributionSetActionNavigationMenu',
147 'DistributionSetBreadcrumb',
148 'DistributionSetContextMenu',
149- 'DistributionSetFacets',
150 'DistributionSetNavigation',
151 'DistributionSetView',
152 'DistributionSpecificationsMenu',
153@@ -218,13 +217,6 @@
154 text = 'Distributions'
155
156
157-class DistributionSetFacets(StandardLaunchpadFacets):
158-
159- usedfor = IDistributionSet
160-
161- enable_only = ['overview', ]
162-
163-
164 class DistributionSetContextMenu(ContextMenu):
165
166 usedfor = IDistributionSet
167
168=== modified file 'lib/lp/registry/browser/product.py'
169--- lib/lp/registry/browser/product.py 2013-04-10 08:35:47 +0000
170+++ lib/lp/registry/browser/product.py 2014-02-26 03:55:49 +0000
171@@ -31,7 +31,6 @@
172 'ProductReviewLicenseView',
173 'ProductSeriesSetView',
174 'ProductSetBreadcrumb',
175- 'ProductSetFacets',
176 'ProductSetNavigation',
177 'ProductSetReviewLicensesView',
178 'ProductSetView',
179@@ -636,14 +635,6 @@
180 text = "Projects"
181
182
183-class ProductSetFacets(StandardLaunchpadFacets):
184- """The links that will appear in the facet menu for the IProductSet."""
185-
186- usedfor = IProductSet
187-
188- enable_only = ['overview', 'branches']
189-
190-
191 class SortSeriesMixin:
192 """Provide access to helpers for series."""
193
194
195=== modified file 'lib/lp/services/statistics/browser/launchpadstatistic.py'
196--- lib/lp/services/statistics/browser/launchpadstatistic.py 2012-01-01 02:58:52 +0000
197+++ lib/lp/services/statistics/browser/launchpadstatistic.py 2014-02-26 03:55:49 +0000
198@@ -7,24 +7,9 @@
199
200 __all__ = [
201 'LaunchpadStatisticSet',
202- 'LaunchpadStatisticSetFacets',
203 ]
204
205-from lp.services.statistics.interfaces.statistic import ILaunchpadStatisticSet
206-from lp.services.webapp import (
207- LaunchpadView,
208- StandardLaunchpadFacets,
209- )
210-
211-
212-class LaunchpadStatisticSetFacets(StandardLaunchpadFacets):
213- """The links that will appear in the facet menu for the
214- ILaunchpadStatisticSet.
215- """
216-
217- usedfor = ILaunchpadStatisticSet
218-
219- enable_only = ['overview',]
220+from lp.services.webapp import LaunchpadView
221
222
223 class LaunchpadStatisticSet(LaunchpadView):
224
225=== modified file 'lib/lp/soyuz/browser/build.py'
226--- lib/lp/soyuz/browser/build.py 2013-11-26 01:44:28 +0000
227+++ lib/lp/soyuz/browser/build.py 2014-02-26 03:55:49 +0000
228@@ -69,7 +69,6 @@
229 GetitemNavigation,
230 LaunchpadView,
231 Link,
232- StandardLaunchpadFacets,
233 stepthrough,
234 )
235 from lp.services.webapp.authorization import check_permission
236@@ -151,14 +150,6 @@
237 return None
238
239
240-class BuildFacets(StandardLaunchpadFacets):
241- """The links that will appear in the facet menu for an
242- IBinaryPackageBuild."""
243- enable_only = ['overview']
244-
245- usedfor = IBinaryPackageBuild
246-
247-
248 class BuildContextMenu(ContextMenu):
249 """Overview menu for build records """
250 usedfor = IBinaryPackageBuild
251
252=== modified file 'lib/lp/soyuz/browser/configure.zcml'
253--- lib/lp/soyuz/browser/configure.zcml 2013-11-15 06:36:55 +0000
254+++ lib/lp/soyuz/browser/configure.zcml 2014-02-26 03:55:49 +0000
255@@ -500,10 +500,6 @@
256 name="+portlet-published"
257 template="../templates/distroseriesbinarypackage-portlet-published.pt"/>
258 </browser:pages>
259- <browser:menus
260- classes="
261- DistroSeriesBinaryPackageFacets"
262- module="lp.soyuz.browser.distroseriesbinarypackage"/>
263
264 <browser:defaultView
265 for="lp.soyuz.interfaces.distroarchseries.IDistroArchSeries"
266
267=== modified file 'lib/lp/soyuz/browser/distroseriesbinarypackage.py'
268--- lib/lp/soyuz/browser/distroseriesbinarypackage.py 2011-12-24 17:49:30 +0000
269+++ lib/lp/soyuz/browser/distroseriesbinarypackage.py 2014-02-26 03:55:49 +0000
270@@ -5,7 +5,6 @@
271
272 __all__ = [
273 'DistroSeriesBinaryPackageBreadcrumb',
274- 'DistroSeriesBinaryPackageFacets',
275 'DistroSeriesBinaryPackageNavigation',
276 'DistroSeriesBinaryPackageView',
277 ]
278@@ -16,7 +15,6 @@
279 ApplicationMenu,
280 LaunchpadView,
281 Navigation,
282- StandardLaunchpadFacets,
283 )
284 from lp.services.webapp.breadcrumb import Breadcrumb
285 from lp.soyuz.interfaces.distroseriesbinarypackage import (
286@@ -24,14 +22,6 @@
287 )
288
289
290-class DistroSeriesBinaryPackageFacets(StandardLaunchpadFacets):
291- # XXX mpt 2006-10-04: A DistroArchSeriesBinaryPackage is not a structural
292- # object. It should inherit all navigation from its distro series.
293-
294- usedfor = IDistroSeriesBinaryPackage
295- enable_only = ['overview']
296-
297-
298 class DistroSeriesBinaryPackageOverviewMenu(ApplicationMenu):
299
300 usedfor = IDistroSeriesBinaryPackage
301
302=== modified file 'lib/lp/translations/browser/configure.zcml'
303--- lib/lp/translations/browser/configure.zcml 2014-02-24 06:50:46 +0000
304+++ lib/lp/translations/browser/configure.zcml 2014-02-26 03:55:49 +0000
305@@ -158,9 +158,7 @@
306 rootsite="translations"/>
307 <browser:menus
308 module="lp.translations.browser.pofile"
309- classes="
310- POFileFacets
311- POFileNavigationMenu"/>
312+ classes="POFileNavigationMenu"/>
313 <browser:defaultView
314 for="lp.translations.interfaces.pofile.IPOFile"
315 name="+translate"/>
316@@ -358,9 +356,7 @@
317 class="lp.translations.browser.potemplate.POTemplateExportView"/>
318 <browser:menus
319 module="lp.translations.browser.potemplate"
320- classes="
321- POTemplateFacets
322- POTemplateMenu"/>
323+ classes="POTemplateMenu"/>
324 <browser:url
325 for="lp.translations.interfaces.potemplate.IPOTemplateSubset"
326 urldata="lp.translations.browser.potemplate.POTemplateSubsetURL"/>
327@@ -453,9 +449,7 @@
328 rootsite="translations"/>
329 <browser:menus
330 module="lp.translations.browser.translationmessage"
331- classes="
332- CurrentTranslationMessageFacets
333- CurrentTranslationMessageAppMenus"/>
334+ classes="CurrentTranslationMessageAppMenus"/>
335 <browser:defaultView
336 for="lp.translations.interfaces.translationmessage.ITranslationMessage"
337 name="+index"/>
338
339=== modified file 'lib/lp/translations/browser/pofile.py'
340--- lib/lp/translations/browser/pofile.py 2012-12-10 23:41:24 +0000
341+++ lib/lp/translations/browser/pofile.py 2014-02-26 03:55:49 +0000
342@@ -7,7 +7,6 @@
343
344 __all__ = [
345 'POExportView',
346- 'POFileFacets',
347 'POFileFilteredView',
348 'POFileNavigation',
349 'POFileNavigationMenu',
350@@ -44,7 +43,6 @@
351 from lp.services.webapp.escaping import structured
352 from lp.services.webapp.interfaces import ILaunchBag
353 from lp.translations.browser.poexportrequest import BaseExportView
354-from lp.translations.browser.potemplate import POTemplateFacets
355 from lp.translations.browser.translationmessage import (
356 BaseTranslationView,
357 CurrentTranslationMessageView,
358@@ -90,13 +88,6 @@
359 return potmsgset.getCurrentTranslationMessageOrDummy(self.context)
360
361
362-class POFileFacets(POTemplateFacets):
363- usedfor = IPOFile
364-
365- def __init__(self, context):
366- POTemplateFacets.__init__(self, context.potemplate)
367-
368-
369 class POFileMenuMixin:
370 """Mixin class to share code between navigation and action menus."""
371
372
373=== modified file 'lib/lp/translations/browser/potemplate.py'
374--- lib/lp/translations/browser/potemplate.py 2013-10-21 01:51:13 +0000
375+++ lib/lp/translations/browser/potemplate.py 2014-02-26 03:55:49 +0000
376@@ -8,7 +8,6 @@
377 'POTemplateAdminView',
378 'POTemplateBreadcrumb',
379 'POTemplateEditView',
380- 'POTemplateFacets',
381 'POTemplateExportView',
382 'POTemplateMenu',
383 'POTemplateNavigation',
384@@ -52,11 +51,7 @@
385 )
386 from lp.app.errors import NotFoundError
387 from lp.app.validators.name import valid_name
388-from lp.registry.browser.productseries import ProductSeriesFacets
389-from lp.registry.browser.sourcepackage import SourcePackageFacets
390-from lp.registry.interfaces.productseries import IProductSeries
391 from lp.registry.interfaces.role import IPersonRoles
392-from lp.registry.interfaces.sourcepackage import ISourcePackage
393 from lp.registry.model.packaging import Packaging
394 from lp.registry.model.product import Product
395 from lp.registry.model.productseries import ProductSeries
396@@ -70,7 +65,6 @@
397 Link,
398 Navigation,
399 NavigationMenu,
400- StandardLaunchpadFacets,
401 )
402 from lp.services.webapp.authorization import check_permission
403 from lp.services.webapp.breadcrumb import Breadcrumb
404@@ -146,61 +140,6 @@
405 return self.context.newPOFile(name, owner=user)
406
407
408-class POTemplateFacets(StandardLaunchpadFacets):
409- usedfor = IPOTemplate
410-
411- def __init__(self, context):
412- StandardLaunchpadFacets.__init__(self, context)
413- target = context.translationtarget
414- if IProductSeries.providedBy(target):
415- self._is_product_series = True
416- self.target_facets = ProductSeriesFacets(target)
417- elif ISourcePackage.providedBy(target):
418- self._is_product_series = False
419- self.target_facets = SourcePackageFacets(target)
420- else:
421- # We don't know yet how to handle this target.
422- raise NotImplementedError
423-
424- # Enable only the menus that the translation target uses.
425- self.enable_only = self.target_facets.enable_only
426-
427- # From an IPOTemplate URL, we reach its translationtarget (either
428- # ISourcePackage or IProductSeries using self.target.
429- self.target = '../../'
430-
431- def overview(self):
432- overview_link = self.target_facets.overview()
433- overview_link.target = self.target
434- return overview_link
435-
436- def translations(self):
437- translations_link = self.target_facets.translations()
438- translations_link.target = self.target
439- return translations_link
440-
441- def bugs(self):
442- bugs_link = self.target_facets.bugs()
443- bugs_link.target = self.target
444- return bugs_link
445-
446- def answers(self):
447- answers_link = self.target_facets.answers()
448- answers_link.target = self.target
449- return answers_link
450-
451- def specifications(self):
452- specifications_link = self.target_facets.specifications()
453- specifications_link.target = self.target
454- return specifications_link
455-
456- def branches(self):
457- branches_link = self.target_facets.branches()
458- if not self._is_product_series:
459- branches_link.target = self.target
460- return branches_link
461-
462-
463 class POTemplateMenu(NavigationMenu):
464 """Navigation menus for `IPOTemplate` objects."""
465 usedfor = IPOTemplate
466
467=== modified file 'lib/lp/translations/browser/translationmessage.py'
468--- lib/lp/translations/browser/translationmessage.py 2013-04-10 08:35:47 +0000
469+++ lib/lp/translations/browser/translationmessage.py 2014-02-26 03:55:49 +0000
470@@ -10,7 +10,6 @@
471 'contains_translations',
472 'convert_translationmessage_to_submission',
473 'CurrentTranslationMessageAppMenus',
474- 'CurrentTranslationMessageFacets',
475 'CurrentTranslationMessageIndexView',
476 'CurrentTranslationMessagePageView',
477 'CurrentTranslationMessageView',
478@@ -56,7 +55,6 @@
479 count_lines,
480 text_to_html,
481 )
482-from lp.translations.browser.potemplate import POTemplateFacets
483 from lp.translations.interfaces.pofile import IPOFileAlternativeLanguage
484 from lp.translations.interfaces.side import ITranslationSideTraitsSet
485 from lp.translations.interfaces.translationmessage import (
486@@ -192,13 +190,6 @@
487 return contents
488
489
490-class CurrentTranslationMessageFacets(POTemplateFacets):
491- usedfor = ITranslationMessage
492-
493- def __init__(self, context):
494- POTemplateFacets.__init__(self, context.browser_pofile.potemplate)
495-
496-
497 class CurrentTranslationMessageAppMenus(ApplicationMenu):
498 usedfor = ITranslationMessage
499 facet = 'translations'