Updated header and footer renderers
authorThierry Florac <thierry.florac@onf.fr>
Wed, 27 Jun 2018 15:33:12 +0200
changeset 762 2df58f4a11df
parent 761 ea8f9d40935e
child 763 be9a6c93f41e
Updated header and footer renderers
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	Wed Jun 27 15:32:31 2018 +0200
+++ b/src/pyams_content/features/footer/skin/__init__.py	Wed Jun 27 15:33:12 2018 +0200
@@ -24,6 +24,7 @@
 # import packages
 from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_utils.adapter import adapter_config
+from pyams_utils.traversing import get_parent
 from pyramid.decorator import reify
 
 from pyams_content import _
@@ -39,7 +40,8 @@
         context = self.request.annotations.get(DISPLAY_CONTEXT)
         if context is None:
             context = self.context
-        settings = IFooterSettings(context)
+        target = get_parent(context, IFooterTarget)
+        settings = IFooterSettings(target)
         while settings.inherit:
             settings = IFooterSettings(settings.parent)
         return settings.settings
--- a/src/pyams_content/features/header/skin/__init__.py	Wed Jun 27 15:32:31 2018 +0200
+++ b/src/pyams_content/features/header/skin/__init__.py	Wed Jun 27 15:33:12 2018 +0200
@@ -24,6 +24,7 @@
 # import packages
 from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_utils.adapter import adapter_config
+from pyams_utils.traversing import get_parent
 from pyramid.decorator import reify
 
 from pyams_content import _
@@ -39,7 +40,8 @@
         context = self.request.annotations.get(DISPLAY_CONTEXT)
         if context is None:
             context = self.context
-        settings = IHeaderSettings(context)
+        target = get_parent(context, IHeaderTarget)
+        settings = IHeaderSettings(target)
         while settings.inherit:
             settings = IHeaderSettings(settings.parent)
         return settings.settings