--- a/src/pyams_portal/interfaces/__init__.py Fri Jul 20 12:52:19 2018 +0200
+++ b/src/pyams_portal/interfaces/__init__.py Sat Jul 21 14:25:53 2018 +0200
@@ -109,6 +109,9 @@
portlet_name = Attribute("Portlet name")
+ def get_portlet(self):
+ """Return portlet utility matching current portlet name"""
+
can_inherit = Attribute("Can inherit parent configuration?")
parent = Attribute("Portlet configuration parent")
--- a/src/pyams_portal/portlet.py Fri Jul 20 12:52:19 2018 +0200
+++ b/src/pyams_portal/portlet.py Sat Jul 21 14:25:53 2018 +0200
@@ -35,6 +35,7 @@
from pyams_cache.beaker import get_cache
from pyams_utils.adapter import adapter_config, ContextAdapter, get_adapter_weight, get_annotation_adapter
from pyams_utils.factory import get_object_factory, is_interface
+from pyams_utils.registry import get_global_registry
from pyams_utils.request import check_request
from pyams_utils.vocabulary import vocabulary_config
from pyams_viewlet.viewlet import ViewContentProvider
@@ -358,6 +359,9 @@
settings.configuration = self
self._settings = settings
+ def get_portlet(self):
+ return get_global_registry().queryUtility(IPortlet, name=self.portlet_name)
+
@property
def can_inherit(self):
return not IPortalTemplate.providedBy(self.__parent__)