← Back to team overview

launchpad-reviewers team mailing list archive

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

 

William Grant has proposed merging lp:~wgrant/launchpad/kill-excessive-facets into lp:launchpad.

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.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #84839 in Launchpad itself: "Build farm and build machines have their own unusable tabs"
  https://bugs.launchpad.net/launchpad/+bug/84839
  Bug #115738 in Launchpad itself: "On distribution release binary package page, only "Overview" is available"
  https://bugs.launchpad.net/launchpad/+bug/115738
  Bug #597173 in Launchpad itself: "Code tab meaninglessly active on project registration page"
  https://bugs.launchpad.net/launchpad/+bug/597173

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/kill-excessive-facets/+merge/208265

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).
-- 
https://code.launchpad.net/~wgrant/launchpad/kill-excessive-facets/+merge/208265
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/kill-excessive-facets into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/configure.zcml'
--- lib/lp/blueprints/browser/configure.zcml	2014-02-19 00:35:25 +0000
+++ lib/lp/blueprints/browser/configure.zcml	2014-02-26 03:55:49 +0000
@@ -182,7 +182,6 @@
         classes="
             SprintFacets
             SprintOverviewMenu
-            SprintSetFacets
             SprintSetNavigationMenu
             SprintSpecificationsMenu
             "

=== modified file 'lib/lp/blueprints/browser/sprint.py'
--- lib/lp/blueprints/browser/sprint.py	2013-04-16 01:18:10 +0000
+++ lib/lp/blueprints/browser/sprint.py	2014-02-26 03:55:49 +0000
@@ -15,7 +15,6 @@
     'SprintNavigation',
     'SprintOverviewMenu',
     'SprintSetBreadcrumb',
-    'SprintSetFacets',
     'SprintSetNavigation',
     'SprintSetView',
     'SprintSpecificationsMenu',
@@ -157,13 +156,6 @@
     text = 'Meetings'
 
 
-class SprintSetFacets(StandardLaunchpadFacets):
-    """The facet menu for an ISprintSet."""
-
-    usedfor = ISprintSet
-    enable_only = ['overview', ]
-
-
 class HasSprintsView(LaunchpadView):
 
     page_title = 'Events'

=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py	2013-10-14 05:27:40 +0000
+++ lib/lp/bugs/browser/bug.py	2014-02-26 03:55:49 +0000
@@ -200,8 +200,10 @@
 class BugFacets(StandardLaunchpadFacets):
     """The links that will appear in the facet menu for an `IBug`.
 
-    However, we never show this, but it does apply to things like
-    bug nominations, by 'acquisition'.
+    This is rarely seen, as most bug views are actually on BugTask. But
+    it's inherited by views on objects subordinate to the Bug itself,
+    eg.  nominations and attachments, where we don't have a pillar
+    context to switch within.
     """
 
     usedfor = IBug

=== modified file 'lib/lp/buildmaster/browser/builder.py'
--- lib/lp/buildmaster/browser/builder.py	2013-12-03 09:52:27 +0000
+++ lib/lp/buildmaster/browser/builder.py	2014-02-26 03:55:49 +0000
@@ -6,12 +6,10 @@
 __metaclass__ = type
 
 __all__ = [
-    'BuilderFacets',
     'BuilderOverviewMenu',
     'BuilderNavigation',
     'BuilderSetAddView',
     'BuilderSetBreadcrumb',
-    'BuilderSetFacets',
     'BuilderSetOverviewMenu',
     'BuilderSetNavigation',
     'BuilderSetView',
@@ -54,7 +52,6 @@
     LaunchpadView,
     Link,
     Navigation,
-    StandardLaunchpadFacets,
     stepthrough,
     )
 from lp.services.webapp.batching import StormRangeFactory
@@ -88,20 +85,6 @@
     usedfor = IBuilder
 
 
-class BuilderSetFacets(StandardLaunchpadFacets):
-    """The links that will appear in the facet menu for an IBuilderSet."""
-    enable_only = ['overview']
-
-    usedfor = IBuilderSet
-
-
-class BuilderFacets(StandardLaunchpadFacets):
-    """The links that will appear in the facet menu for an IBuilder."""
-    enable_only = ['overview']
-
-    usedfor = IBuilder
-
-
 class BuilderSetOverviewMenu(ApplicationMenu):
     """Overview Menu for IBuilderSet."""
     usedfor = IBuilderSet

=== modified file 'lib/lp/buildmaster/browser/configure.zcml'
--- lib/lp/buildmaster/browser/configure.zcml	2013-11-15 06:36:55 +0000
+++ lib/lp/buildmaster/browser/configure.zcml	2014-02-26 03:55:49 +0000
@@ -88,13 +88,9 @@
         permission="launchpad.Edit"
         template="../templates/builder-edit.pt"/>
     <browser:menus
-        classes="
-            BuilderSetFacets
-            BuilderSetOverviewMenu"
+        classes="BuilderSetOverviewMenu"
         module="lp.buildmaster.browser.builder"/>
     <browser:menus
-        classes="
-            BuilderFacets
-            BuilderOverviewMenu"
+        classes="BuilderOverviewMenu"
         module="lp.buildmaster.browser.builder"/>
 </configure>

=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml	2014-02-25 06:42:01 +0000
+++ lib/lp/registry/browser/configure.zcml	2014-02-26 03:55:49 +0000
@@ -1594,7 +1594,6 @@
             ProductFacets
             ProductNavigationMenu
             ProductOverviewMenu
-            ProductSetFacets
             ProductSetNavigationMenu
             ProductSpecificationsMenu
             "
@@ -1949,7 +1948,6 @@
             DistributionOverviewMenu
             DistributionSetActionNavigationMenu
             DistributionSetContextMenu
-            DistributionSetFacets
             DistributionSpecificationsMenu
             "
         module="lp.registry.browser.distribution"/>

=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py	2013-09-18 06:34:44 +0000
+++ lib/lp/registry/browser/distribution.py	2014-02-26 03:55:49 +0000
@@ -30,7 +30,6 @@
     'DistributionSetActionNavigationMenu',
     'DistributionSetBreadcrumb',
     'DistributionSetContextMenu',
-    'DistributionSetFacets',
     'DistributionSetNavigation',
     'DistributionSetView',
     'DistributionSpecificationsMenu',
@@ -218,13 +217,6 @@
     text = 'Distributions'
 
 
-class DistributionSetFacets(StandardLaunchpadFacets):
-
-    usedfor = IDistributionSet
-
-    enable_only = ['overview', ]
-
-
 class DistributionSetContextMenu(ContextMenu):
 
     usedfor = IDistributionSet

=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py	2013-04-10 08:35:47 +0000
+++ lib/lp/registry/browser/product.py	2014-02-26 03:55:49 +0000
@@ -31,7 +31,6 @@
     'ProductReviewLicenseView',
     'ProductSeriesSetView',
     'ProductSetBreadcrumb',
-    'ProductSetFacets',
     'ProductSetNavigation',
     'ProductSetReviewLicensesView',
     'ProductSetView',
@@ -636,14 +635,6 @@
     text = "Projects"
 
 
-class ProductSetFacets(StandardLaunchpadFacets):
-    """The links that will appear in the facet menu for the IProductSet."""
-
-    usedfor = IProductSet
-
-    enable_only = ['overview', 'branches']
-
-
 class SortSeriesMixin:
     """Provide access to helpers for series."""
 

=== modified file 'lib/lp/services/statistics/browser/launchpadstatistic.py'
--- lib/lp/services/statistics/browser/launchpadstatistic.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/statistics/browser/launchpadstatistic.py	2014-02-26 03:55:49 +0000
@@ -7,24 +7,9 @@
 
 __all__ = [
     'LaunchpadStatisticSet',
-    'LaunchpadStatisticSetFacets',
     ]
 
-from lp.services.statistics.interfaces.statistic import ILaunchpadStatisticSet
-from lp.services.webapp import (
-    LaunchpadView,
-    StandardLaunchpadFacets,
-    )
-
-
-class LaunchpadStatisticSetFacets(StandardLaunchpadFacets):
-    """The links that will appear in the facet menu for the
-    ILaunchpadStatisticSet.
-    """
-
-    usedfor = ILaunchpadStatisticSet
-
-    enable_only = ['overview',]
+from lp.services.webapp import LaunchpadView
 
 
 class LaunchpadStatisticSet(LaunchpadView):

=== modified file 'lib/lp/soyuz/browser/build.py'
--- lib/lp/soyuz/browser/build.py	2013-11-26 01:44:28 +0000
+++ lib/lp/soyuz/browser/build.py	2014-02-26 03:55:49 +0000
@@ -69,7 +69,6 @@
     GetitemNavigation,
     LaunchpadView,
     Link,
-    StandardLaunchpadFacets,
     stepthrough,
     )
 from lp.services.webapp.authorization import check_permission
@@ -151,14 +150,6 @@
             return None
 
 
-class BuildFacets(StandardLaunchpadFacets):
-    """The links that will appear in the facet menu for an
-    IBinaryPackageBuild."""
-    enable_only = ['overview']
-
-    usedfor = IBinaryPackageBuild
-
-
 class BuildContextMenu(ContextMenu):
     """Overview menu for build records """
     usedfor = IBinaryPackageBuild

=== modified file 'lib/lp/soyuz/browser/configure.zcml'
--- lib/lp/soyuz/browser/configure.zcml	2013-11-15 06:36:55 +0000
+++ lib/lp/soyuz/browser/configure.zcml	2014-02-26 03:55:49 +0000
@@ -500,10 +500,6 @@
             name="+portlet-published"
             template="../templates/distroseriesbinarypackage-portlet-published.pt"/>
     </browser:pages>
-    <browser:menus
-        classes="
-            DistroSeriesBinaryPackageFacets"
-        module="lp.soyuz.browser.distroseriesbinarypackage"/>
 
         <browser:defaultView
             for="lp.soyuz.interfaces.distroarchseries.IDistroArchSeries"

=== modified file 'lib/lp/soyuz/browser/distroseriesbinarypackage.py'
--- lib/lp/soyuz/browser/distroseriesbinarypackage.py	2011-12-24 17:49:30 +0000
+++ lib/lp/soyuz/browser/distroseriesbinarypackage.py	2014-02-26 03:55:49 +0000
@@ -5,7 +5,6 @@
 
 __all__ = [
     'DistroSeriesBinaryPackageBreadcrumb',
-    'DistroSeriesBinaryPackageFacets',
     'DistroSeriesBinaryPackageNavigation',
     'DistroSeriesBinaryPackageView',
     ]
@@ -16,7 +15,6 @@
     ApplicationMenu,
     LaunchpadView,
     Navigation,
-    StandardLaunchpadFacets,
     )
 from lp.services.webapp.breadcrumb import Breadcrumb
 from lp.soyuz.interfaces.distroseriesbinarypackage import (
@@ -24,14 +22,6 @@
     )
 
 
-class DistroSeriesBinaryPackageFacets(StandardLaunchpadFacets):
-    # XXX mpt 2006-10-04: A DistroArchSeriesBinaryPackage is not a structural
-    # object. It should inherit all navigation from its distro series.
-
-    usedfor = IDistroSeriesBinaryPackage
-    enable_only = ['overview']
-
-
 class DistroSeriesBinaryPackageOverviewMenu(ApplicationMenu):
 
     usedfor = IDistroSeriesBinaryPackage

=== modified file 'lib/lp/translations/browser/configure.zcml'
--- lib/lp/translations/browser/configure.zcml	2014-02-24 06:50:46 +0000
+++ lib/lp/translations/browser/configure.zcml	2014-02-26 03:55:49 +0000
@@ -158,9 +158,7 @@
             rootsite="translations"/>
         <browser:menus
             module="lp.translations.browser.pofile"
-            classes="
-                POFileFacets
-                POFileNavigationMenu"/>
+            classes="POFileNavigationMenu"/>
         <browser:defaultView
             for="lp.translations.interfaces.pofile.IPOFile"
             name="+translate"/>
@@ -358,9 +356,7 @@
             class="lp.translations.browser.potemplate.POTemplateExportView"/>
         <browser:menus
             module="lp.translations.browser.potemplate"
-            classes="
-                POTemplateFacets
-                POTemplateMenu"/>
+            classes="POTemplateMenu"/>
         <browser:url
             for="lp.translations.interfaces.potemplate.IPOTemplateSubset"
             urldata="lp.translations.browser.potemplate.POTemplateSubsetURL"/>
@@ -453,9 +449,7 @@
             rootsite="translations"/>
         <browser:menus
             module="lp.translations.browser.translationmessage"
-            classes="
-                CurrentTranslationMessageFacets
-                CurrentTranslationMessageAppMenus"/>
+            classes="CurrentTranslationMessageAppMenus"/>
         <browser:defaultView
             for="lp.translations.interfaces.translationmessage.ITranslationMessage"
             name="+index"/>

=== modified file 'lib/lp/translations/browser/pofile.py'
--- lib/lp/translations/browser/pofile.py	2012-12-10 23:41:24 +0000
+++ lib/lp/translations/browser/pofile.py	2014-02-26 03:55:49 +0000
@@ -7,7 +7,6 @@
 
 __all__ = [
     'POExportView',
-    'POFileFacets',
     'POFileFilteredView',
     'POFileNavigation',
     'POFileNavigationMenu',
@@ -44,7 +43,6 @@
 from lp.services.webapp.escaping import structured
 from lp.services.webapp.interfaces import ILaunchBag
 from lp.translations.browser.poexportrequest import BaseExportView
-from lp.translations.browser.potemplate import POTemplateFacets
 from lp.translations.browser.translationmessage import (
     BaseTranslationView,
     CurrentTranslationMessageView,
@@ -90,13 +88,6 @@
         return potmsgset.getCurrentTranslationMessageOrDummy(self.context)
 
 
-class POFileFacets(POTemplateFacets):
-    usedfor = IPOFile
-
-    def __init__(self, context):
-        POTemplateFacets.__init__(self, context.potemplate)
-
-
 class POFileMenuMixin:
     """Mixin class to share code between navigation and action menus."""
 

=== modified file 'lib/lp/translations/browser/potemplate.py'
--- lib/lp/translations/browser/potemplate.py	2013-10-21 01:51:13 +0000
+++ lib/lp/translations/browser/potemplate.py	2014-02-26 03:55:49 +0000
@@ -8,7 +8,6 @@
     'POTemplateAdminView',
     'POTemplateBreadcrumb',
     'POTemplateEditView',
-    'POTemplateFacets',
     'POTemplateExportView',
     'POTemplateMenu',
     'POTemplateNavigation',
@@ -52,11 +51,7 @@
     )
 from lp.app.errors import NotFoundError
 from lp.app.validators.name import valid_name
-from lp.registry.browser.productseries import ProductSeriesFacets
-from lp.registry.browser.sourcepackage import SourcePackageFacets
-from lp.registry.interfaces.productseries import IProductSeries
 from lp.registry.interfaces.role import IPersonRoles
-from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.registry.model.packaging import Packaging
 from lp.registry.model.product import Product
 from lp.registry.model.productseries import ProductSeries
@@ -70,7 +65,6 @@
     Link,
     Navigation,
     NavigationMenu,
-    StandardLaunchpadFacets,
     )
 from lp.services.webapp.authorization import check_permission
 from lp.services.webapp.breadcrumb import Breadcrumb
@@ -146,61 +140,6 @@
             return self.context.newPOFile(name, owner=user)
 
 
-class POTemplateFacets(StandardLaunchpadFacets):
-    usedfor = IPOTemplate
-
-    def __init__(self, context):
-        StandardLaunchpadFacets.__init__(self, context)
-        target = context.translationtarget
-        if IProductSeries.providedBy(target):
-            self._is_product_series = True
-            self.target_facets = ProductSeriesFacets(target)
-        elif ISourcePackage.providedBy(target):
-            self._is_product_series = False
-            self.target_facets = SourcePackageFacets(target)
-        else:
-            # We don't know yet how to handle this target.
-            raise NotImplementedError
-
-        # Enable only the menus that the translation target uses.
-        self.enable_only = self.target_facets.enable_only
-
-        # From an IPOTemplate URL, we reach its translationtarget (either
-        # ISourcePackage or IProductSeries using self.target.
-        self.target = '../../'
-
-    def overview(self):
-        overview_link = self.target_facets.overview()
-        overview_link.target = self.target
-        return overview_link
-
-    def translations(self):
-        translations_link = self.target_facets.translations()
-        translations_link.target = self.target
-        return translations_link
-
-    def bugs(self):
-        bugs_link = self.target_facets.bugs()
-        bugs_link.target = self.target
-        return bugs_link
-
-    def answers(self):
-        answers_link = self.target_facets.answers()
-        answers_link.target = self.target
-        return answers_link
-
-    def specifications(self):
-        specifications_link = self.target_facets.specifications()
-        specifications_link.target = self.target
-        return specifications_link
-
-    def branches(self):
-        branches_link = self.target_facets.branches()
-        if not self._is_product_series:
-            branches_link.target = self.target
-        return branches_link
-
-
 class POTemplateMenu(NavigationMenu):
     """Navigation menus for `IPOTemplate` objects."""
     usedfor = IPOTemplate

=== modified file 'lib/lp/translations/browser/translationmessage.py'
--- lib/lp/translations/browser/translationmessage.py	2013-04-10 08:35:47 +0000
+++ lib/lp/translations/browser/translationmessage.py	2014-02-26 03:55:49 +0000
@@ -10,7 +10,6 @@
     'contains_translations',
     'convert_translationmessage_to_submission',
     'CurrentTranslationMessageAppMenus',
-    'CurrentTranslationMessageFacets',
     'CurrentTranslationMessageIndexView',
     'CurrentTranslationMessagePageView',
     'CurrentTranslationMessageView',
@@ -56,7 +55,6 @@
     count_lines,
     text_to_html,
     )
-from lp.translations.browser.potemplate import POTemplateFacets
 from lp.translations.interfaces.pofile import IPOFileAlternativeLanguage
 from lp.translations.interfaces.side import ITranslationSideTraitsSet
 from lp.translations.interfaces.translationmessage import (
@@ -192,13 +190,6 @@
         return contents
 
 
-class CurrentTranslationMessageFacets(POTemplateFacets):
-    usedfor = ITranslationMessage
-
-    def __init__(self, context):
-        POTemplateFacets.__init__(self, context.browser_pofile.potemplate)
-
-
 class CurrentTranslationMessageAppMenus(ApplicationMenu):
     usedfor = ITranslationMessage
     facet = 'translations'


Follow ups