From 13b8bc143c2c1f8a4136133234cbdac5ed0ea13a Mon Sep 17 00:00:00 2001 From: David Henne Date: Thu, 2 Dec 2021 12:11:03 -0600 Subject: [PATCH 1/2] reconfigure breadcrumbs view and handle context --- castle/cms/browser/configure.zcml | 2 +- castle/cms/browser/navigation.py | 12 ++++++++++++ castle/cms/toolbar.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/castle/cms/browser/configure.zcml b/castle/cms/browser/configure.zcml index 6471f3bb4..3a99639fc 100644 --- a/castle/cms/browser/configure.zcml +++ b/castle/cms/browser/configure.zcml @@ -309,7 +309,7 @@ Date: Thu, 2 Dec 2021 13:03:03 -0600 Subject: [PATCH 2/2] cleanup and exception handling --- castle/cms/browser/navigation.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/castle/cms/browser/navigation.py b/castle/cms/browser/navigation.py index 0ea3526d1..246b8bf10 100644 --- a/castle/cms/browser/navigation.py +++ b/castle/cms/browser/navigation.py @@ -1,6 +1,7 @@ from Products.CMFCore.interfaces import ISiteRoot from Products.CMFCore.WorkflowCore import WorkflowException from Acquisition import aq_inner +from Products.CMFCore.interfaces import IContentish from Products.CMFPlone import utils from Products.CMFPlone.browser.interfaces import INavigationBreadcrumbs from Products.CMFPlone.interfaces import IHideFromBreadcrumbs @@ -8,7 +9,6 @@ from zope.interface import implementer from plone import api from castle.cms.browser.utils import Utils -from zope.component.hooks import getSite @implementer(INavigationBreadcrumbs) @@ -16,15 +16,19 @@ class PhysicalNavigationBreadcrumbs(BrowserView): def breadcrumbs(self): # get actual context object if only site root is passed in as context - if self.context == getSite(): + site = api.portal.get() + if self.context == site: context_url = self.request.URL - if '/@@fragment' in context_url: - return [] - site_url = api.portal.get().absolute_url() + site_url = site.absolute_url() path = context_url.replace(site_url, '') if '/layout_view' in path: path = path.replace('/layout_view', '') - self.context = api.content.get(path) + try: + context = api.content.get(path) + if IContentish.providedBy(context): + self.context = context + except Exception: + return [] context = aq_inner(self.context)