Added "get_settings" method
authorThierry Florac <thierry.florac@onf.fr>
Wed, 20 Jun 2018 14:06:52 +0200
changeset 123 827f7278b9fb
parent 122 4fcb3a5afa91
child 124 affd5d9de631
Added "get_settings" method
src/pyams_portal/interfaces/__init__.py
src/pyams_portal/portlet.py
--- a/src/pyams_portal/interfaces/__init__.py	Wed Jun 20 14:05:50 2018 +0200
+++ b/src/pyams_portal/interfaces/__init__.py	Wed Jun 20 14:06:52 2018 +0200
@@ -122,6 +122,9 @@
 
     editor_settings = Attribute("Editor settings")
 
+    def get_settings(self, allow_inherit=True):
+        """Get configuration settings, with or without inheritance"""
+
 
 class IPortletContentProvider(IContentProvider):
     """Portlet content provider"""
--- a/src/pyams_portal/portlet.py	Wed Jun 20 14:05:50 2018 +0200
+++ b/src/pyams_portal/portlet.py	Wed Jun 20 14:06:52 2018 +0200
@@ -346,6 +346,12 @@
     def editor_settings(self):
         return self._settings
 
+    def get_settings(self, allow_inherit=True):
+        if allow_inherit:
+            return self.settings
+        else:
+            return self._settings
+
 
 @adapter_config(context=IPortlet, provides=IPortletConfiguration)
 def portlet_configuration_adapter(portlet):