← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/headingbreadcrumb into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/headingbreadcrumb into lp:launchpad.

Commit message:
Replace IRootContext with IHeadingBreadcrumb. Root contexts are a UI thing, and all that UI is being migrated to the breadcrumb infra.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/headingbreadcrumb/+merge/242014

Replace IRootContext with IHeadingBreadcrumb. Root contexts are a UI thing, and all that UI is being migrated to the breadcrumb infra.
-- 
https://code.launchpad.net/~wgrant/launchpad/headingbreadcrumb/+merge/242014
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/headingbreadcrumb into lp:launchpad.
=== modified file 'lib/lp/app/browser/launchpad.py'
--- lib/lp/app/browser/launchpad.py	2014-11-17 00:06:12 +0000
+++ lib/lp/app/browser/launchpad.py	2014-11-17 18:40:59 +0000
@@ -81,8 +81,8 @@
     )
 from lp.app.interfaces.headings import (
     IEditableContextTitle,
+    IHeadingBreadcrumb,
     IMajorHeadingView,
-    IRootContext,
     )
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.app.interfaces.services import IServiceFactory
@@ -379,7 +379,7 @@
         try:
             return (
                 crumb for crumb in self.items
-                if IRootContext.providedBy(crumb.context)).next()
+                if IHeadingBreadcrumb.providedBy(crumb)).next()
         except StopIteration:
             return None
 

=== modified file 'lib/lp/app/interfaces/headings.py'
--- lib/lp/app/interfaces/headings.py	2010-08-20 20:31:18 +0000
+++ lib/lp/app/interfaces/headings.py	2014-11-17 18:40:59 +0000
@@ -6,21 +6,12 @@
 __metaclass__ = type
 __all__ = [
     'IEditableContextTitle',
+    'IHeadingBreadcrumb',
     'IMajorHeadingView',
-    'IRootContext',
     ]
 
 
-from zope.interface import (
-    Attribute,
-    Interface,
-    )
-
-
-class IRootContext(Interface):
-    """Something that is an object off the Launchpad root."""
-
-    title = Attribute('The title of the root context object.')
+from zope.interface import Interface
 
 
 class IMajorHeadingView(Interface):
@@ -32,3 +23,7 @@
 
     def title_edit_widget():
         """Return the HTML of the editable title widget."""
+
+
+class IHeadingBreadcrumb(Interface):
+    """This breadcrumb can appear in header and thereby has no facet."""

=== modified file 'lib/lp/blueprints/browser/sprint.py'
--- lib/lp/blueprints/browser/sprint.py	2014-02-26 04:41:31 +0000
+++ lib/lp/blueprints/browser/sprint.py	2014-11-17 18:40:59 +0000
@@ -39,7 +39,10 @@
     LaunchpadEditFormView,
     LaunchpadFormView,
     )
-from lp.app.interfaces.headings import IMajorHeadingView
+from lp.app.interfaces.headings import (
+    IHeadingBreadcrumb,
+    IMajorHeadingView,
+    )
 from lp.app.widgets.date import DateTimeWidget
 from lp.blueprints.browser.specificationtarget import (
     HasSpecificationsMenuMixin,
@@ -77,7 +80,10 @@
     StandardLaunchpadFacets,
     )
 from lp.services.webapp.batching import BatchNavigator
-from lp.services.webapp.breadcrumb import Breadcrumb
+from lp.services.webapp.breadcrumb import (
+    Breadcrumb,
+    TitleBreadcrumb,
+    )
 
 
 class SprintFacets(StandardLaunchpadFacets):
@@ -95,6 +101,10 @@
     usedfor = ISprint
 
 
+class SprintBreadcrumb(TitleBreadcrumb):
+    implements(IHeadingBreadcrumb)
+
+
 class SprintOverviewMenu(NavigationMenu):
     """Defines a menu used for the global actions."""
 

=== modified file 'lib/lp/blueprints/configure.zcml'
--- lib/lp/blueprints/configure.zcml	2013-06-28 00:49:47 +0000
+++ lib/lp/blueprints/configure.zcml	2014-11-17 18:40:59 +0000
@@ -38,7 +38,7 @@
   <adapter
       provides="lp.services.webapp.interfaces.IBreadcrumb"
       for="lp.blueprints.interfaces.sprint.ISprint"
-      factory="lp.services.webapp.breadcrumb.TitleBreadcrumb"
+      factory="lp.blueprints.browser.sprint.SprintBreadcrumb"
       permission="zope.Public"/>
   <adapter
       provides="lp.services.webapp.interfaces.IBreadcrumb"

=== modified file 'lib/lp/blueprints/interfaces/sprint.py'
--- lib/lp/blueprints/interfaces/sprint.py	2013-01-07 02:40:55 +0000
+++ lib/lp/blueprints/interfaces/sprint.py	2014-11-17 18:40:59 +0000
@@ -29,7 +29,6 @@
     )
 
 from lp import _
-from lp.app.interfaces.headings import IRootContext
 from lp.app.validators.name import name_validator
 from lp.blueprints.interfaces.specificationtarget import IHasSpecifications
 from lp.registry.interfaces.role import (
@@ -57,7 +56,7 @@
         return getUtility(ISprintSet)[name]
 
 
-class ISprint(IHasOwner, IHasDrivers, IHasSpecifications, IRootContext):
+class ISprint(IHasOwner, IHasDrivers, IHasSpecifications):
     """A sprint, or conference, or meeting."""
 
     id = Int(title=_('The Sprint ID'))

=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py	2014-02-26 04:41:31 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py	2014-11-17 18:40:59 +0000
@@ -22,10 +22,7 @@
 
 from lazr.delegates import delegates
 from lazr.restful.utils import smartquote
-from zope.component import (
-    adapter,
-    getUtility,
-    )
+from zope.component import getUtility
 from zope.interface import (
     implements,
     Interface,
@@ -43,6 +40,7 @@
 from lp.app.browser.stringformatter import extract_email_addresses
 from lp.app.browser.tales import CustomizableFormatter
 from lp.app.enums import ServiceUsage
+from lp.app.interfaces.headings import IHeadingBreadcrumb
 from lp.app.interfaces.launchpad import IServiceUsage
 from lp.bugs.browser.bugtask import BugTargetTraversalMixin
 from lp.bugs.browser.structuralsubscription import (
@@ -102,10 +100,9 @@
         return {'displayname': displayname}
 
 
-@adapter(IDistributionSourcePackage)
 class DistributionSourcePackageBreadcrumb(Breadcrumb):
     """Builds a breadcrumb for an `IDistributionSourcePackage`."""
-    implements(IBreadcrumb)
+    implements(IBreadcrumb, IHeadingBreadcrumb)
 
     @property
     def text(self):

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2014-07-24 08:18:49 +0000
+++ lib/lp/registry/browser/person.py	2014-11-17 18:40:59 +0000
@@ -14,6 +14,7 @@
     'PersonAnswerContactForView',
     'PersonAnswersMenu',
     'PersonBrandingView',
+    'PersonBreadcrumb',
     'PersonCodeOfConductEditView',
     'PersonDeactivateAccountView',
     'PersonEditEmailsView',
@@ -126,6 +127,7 @@
     NotFoundError,
     UnexpectedFormData,
     )
+from lp.app.interfaces.headings import IHeadingBreadcrumb
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.app.validators.email import valid_email
 from lp.app.widgets.image import ImageChangeWidget
@@ -247,6 +249,7 @@
     )
 from lp.services.webapp.authorization import check_permission
 from lp.services.webapp.batching import BatchNavigator
+from lp.services.webapp.breadcrumb import DisplaynameBreadcrumb
 from lp.services.webapp.interfaces import (
     ILaunchBag,
     IOpenLaunchBag,
@@ -272,6 +275,10 @@
 COMMASPACE = ', '
 
 
+class PersonBreadcrumb(DisplaynameBreadcrumb):
+    implements(IHeadingBreadcrumb)
+
+
 class RestrictedMembershipsPersonView(LaunchpadView):
     """Secure access to team membership information for a person.
 

=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py	2014-11-17 00:06:12 +0000
+++ lib/lp/registry/browser/pillar.py	2014-11-17 18:40:59 +0000
@@ -41,6 +41,7 @@
     service_uses_launchpad,
     ServiceUsage,
     )
+from lp.app.interfaces.headings import IHeadingBreadcrumb
 from lp.app.interfaces.launchpad import IServiceUsage
 from lp.app.interfaces.services import IService
 from lp.bugs.browser.structuralsubscription import (
@@ -82,6 +83,7 @@
 
 class PillarBreadcrumb(DisplaynameBreadcrumb):
     """Breadcrumb that uses the displayname or title as appropriate."""
+    implements(IHeadingBreadcrumb)
 
     @property
     def detail(self):

=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py	2014-03-11 09:11:10 +0000
+++ lib/lp/registry/browser/team.py	2014-11-17 18:40:59 +0000
@@ -81,6 +81,7 @@
     )
 from lp.app.browser.tales import PersonFormatterAPI
 from lp.app.errors import UnexpectedFormData
+from lp.app.interfaces.headings import IHeadingBreadcrumb
 from lp.app.validators import LaunchpadValidationError
 from lp.app.validators.validation import validate_new_team_email
 from lp.app.widgets.itemswidgets import (
@@ -1246,6 +1247,7 @@
 
 class TeamBreadcrumb(Breadcrumb):
     """Builds a breadcrumb for an `ITeam`."""
+    implements(IHeadingBreadcrumb)
 
     @property
     def text(self):

=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2014-11-17 00:06:12 +0000
+++ lib/lp/registry/configure.zcml	2014-11-17 18:40:59 +0000
@@ -577,6 +577,8 @@
         factory="lp.registry.adapters.package_to_sourcepackagename"
         permission="zope.Public"/>
     <adapter
+        for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
+        provides="lp.services.webapp.interfaces.IBreadcrumb"
         factory="lp.registry.browser.distributionsourcepackage.DistributionSourcePackageBreadcrumb"/>
 
     <!-- CommercialSubscription -->
@@ -905,7 +907,7 @@
         <adapter
             provides="lp.services.webapp.interfaces.IBreadcrumb"
             for="lp.registry.interfaces.person.IPerson"
-            factory="lp.services.webapp.breadcrumb.DisplaynameBreadcrumb"
+            factory="lp.registry.browser.person.PersonBreadcrumb"
             permission="zope.Public"/>
         <adapter
             provides="lp.services.webapp.interfaces.IBreadcrumb"

=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py	2014-07-30 15:42:05 +0000
+++ lib/lp/registry/interfaces/distribution.py	2014-11-17 18:40:59 +0000
@@ -54,7 +54,6 @@
 from lp import _
 from lp.answers.interfaces.questiontarget import IQuestionTarget
 from lp.app.errors import NameLookupFailed
-from lp.app.interfaces.headings import IRootContext
 from lp.app.interfaces.launchpad import (
     ILaunchpadUsage,
     IServiceUsage,
@@ -641,7 +640,7 @@
 
 class IDistribution(
     IDistributionEditRestricted, IDistributionPublic, IHasBugSupervisor,
-    IQuestionTarget, IRootContext, IStructuralSubscriptionTarget):
+    IQuestionTarget, IStructuralSubscriptionTarget):
     """An operating system distribution.
 
     Launchpadlib example: retrieving the current version of a package in a

=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py	2014-10-22 16:20:30 +0000
+++ lib/lp/registry/interfaces/person.py	2014-11-17 18:40:59 +0000
@@ -94,7 +94,6 @@
 from lp import _
 from lp.answers.interfaces.questionsperson import IQuestionsPerson
 from lp.app.errors import NameLookupFailed
-from lp.app.interfaces.headings import IRootContext
 from lp.app.interfaces.launchpad import (
     IHasIcon,
     IHasLogo,
@@ -1845,7 +1844,7 @@
 
 class IPerson(IPersonPublic, IPersonLimitedView, IPersonViewRestricted,
               IPersonEditRestricted, IPersonSpecialRestricted, IHasStanding,
-              ISetLocation, IRootContext):
+              ISetLocation):
     """A Person."""
     export_as_webservice_entry(plural_name='people')
 

=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py	2014-09-08 21:03:07 +0000
+++ lib/lp/registry/interfaces/product.py	2014-11-17 18:40:59 +0000
@@ -74,7 +74,6 @@
 from lp import _
 from lp.answers.interfaces.questiontarget import IQuestionTarget
 from lp.app.errors import NameLookupFailed
-from lp.app.interfaces.headings import IRootContext
 from lp.app.interfaces.informationtype import IInformationType
 from lp.app.interfaces.launchpad import (
     IHasIcon,
@@ -884,7 +883,7 @@
 class IProduct(
     IBugTarget, IHasBugSupervisor, IHasDrivers, IProductEditRestricted,
     IProductModerateRestricted, IProductDriverRestricted, IProductView,
-    IProductLimitedView, IProductPublic, IQuestionTarget, IRootContext,
+    IProductLimitedView, IProductPublic, IQuestionTarget,
     ISpecificationTarget, IStructuralSubscriptionTarget, IInformationType,
     IPillar):
     """A Product.

=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
--- lib/lp/registry/interfaces/projectgroup.py	2014-09-08 21:03:07 +0000
+++ lib/lp/registry/interfaces/projectgroup.py	2014-11-17 18:40:59 +0000
@@ -41,7 +41,6 @@
     )
 
 from lp import _
-from lp.app.interfaces.headings import IRootContext
 from lp.app.interfaces.launchpad import (
     IHasIcon,
     IHasLogo,
@@ -118,7 +117,7 @@
     ICanGetMilestonesDirectly, IHasAppointedDriver, IHasBranches, IHasBugs,
     IHasDrivers, IHasIcon, IHasLogo, IHasMergeProposals, IHasMilestones,
     IHasMugshot, IHasOwner, IHasSpecifications, IHasSprints,
-    IMakesAnnouncements, IKarmaContext, IRootContext, IHasOfficialBugTags,
+    IMakesAnnouncements, IKarmaContext, IHasOfficialBugTags,
     IServiceUsage):
     """Public IProjectGroup properties."""
 


Follow ups