Use current display context as header and footer context
authorThierry Florac <thierry.florac@onf.fr>
Fri, 22 Jun 2018 13:03:46 +0200
changeset 729 f6594cea3d5a
parent 728 8a4cd44c9134
child 730 8a9dd03f95ac
child 746 97fc5ed136fb
Use current display context as header and footer context
src/pyams_content/features/footer/skin/__init__.py
src/pyams_content/features/header/skin/__init__.py
--- a/src/pyams_content/features/footer/skin/__init__.py	Fri Jun 22 13:03:11 2018 +0200
+++ b/src/pyams_content/features/footer/skin/__init__.py	Fri Jun 22 13:03:46 2018 +0200
@@ -19,6 +19,7 @@
 from pyams_content.features.footer.interfaces import IFooterTarget, IFooterRenderer, IFooterSettings
 from pyams_content.features.renderer.interfaces import HIDDEN_RENDERER_NAME
 from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces.url import DISPLAY_CONTEXT
 
 # import packages
 from pyams_content.features.renderer.skin import BaseContentRenderer
@@ -35,7 +36,10 @@
     def settings(self):
         if self.settings_interface is None:
             return None
-        settings = IFooterSettings(self.context)
+        context = self.request.annotations.get(DISPLAY_CONTEXT)
+        if context is None:
+            context = self.context
+        settings = IFooterSettings(context)
         while settings.inherit:
             settings = IFooterSettings(settings.parent)
         return settings.settings
--- a/src/pyams_content/features/header/skin/__init__.py	Fri Jun 22 13:03:11 2018 +0200
+++ b/src/pyams_content/features/header/skin/__init__.py	Fri Jun 22 13:03:46 2018 +0200
@@ -19,6 +19,7 @@
 from pyams_content.features.header.interfaces import IHeaderTarget, IHeaderRenderer, IHeaderSettings
 from pyams_content.features.renderer.interfaces import HIDDEN_RENDERER_NAME
 from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces.url import DISPLAY_CONTEXT
 
 # import packages
 from pyams_content.features.renderer.skin import BaseContentRenderer
@@ -35,7 +36,10 @@
     def settings(self):
         if self.settings_interface is None:
             return None
-        settings = IHeaderSettings(self.context)
+        context = self.request.annotations.get(DISPLAY_CONTEXT)
+        if context is None:
+            context = self.context
+        settings = IHeaderSettings(context)
         while settings.inherit:
             settings = IHeaderSettings(settings.parent)
         return settings.settings