--- a/src/pyams_portal/portlet.py Sun Jun 10 01:46:38 2018 +0200
+++ b/src/pyams_portal/portlet.py Mon Jun 11 15:29:20 2018 +0200
@@ -129,11 +129,11 @@
def __init__(self, context, request, view, settings):
super(PortletContentProvider, self).__init__(context, request, view)
+ self.portlet = request.registry.queryUtility(IPortlet, name=settings.configuration.portlet_name)
self.settings = settings
- self.portlet = request.registry.getUtility(IPortlet, name=settings.configuration.portlet_name)
def __call__(self):
- if not self.settings.visible:
+ if (self.portlet is None) or not self.settings.visible:
return ''
if self.portlet.permission and not self.request.has_permission(self.portlet.permission):
return ''
@@ -268,14 +268,17 @@
parent = self.__parent__
if IPortalTemplate.providedBy(parent):
return parent
- while IPortalContext.providedBy(parent):
- configuration = IPortalPortletsConfiguration(parent).get_portlet_configuration(self.portlet_id)
- if not configuration.inherit_parent:
- return parent
- page = IPortalPage(parent)
- if not page.inherit_parent:
+ while True:
+ if IPortalContext.providedBy(parent):
+ configuration = IPortalPortletsConfiguration(parent).get_portlet_configuration(self.portlet_id)
+ if not configuration.inherit_parent:
+ return parent
+ page = IPortalPage(parent)
+ if not page.inherit_parent:
+ break
+ parent = parent.__parent__
+ if parent is None:
break
- parent = parent.__parent__
page = IPortalPage(parent, None)
if page is not None:
return page.template