Handle settings inheritance
authorThierry Florac <tflorac@ulthar.net>
Tue, 17 Jul 2018 23:44:05 +0200
changeset 94 6fca8ce6a700
parent 93 d3ef1b0cc076
child 95 8cd70a1eb00c
Handle settings inheritance
src/pyams_default_theme/viewlet/banner/__init__.py
src/pyams_default_theme/viewlet/logo/__init__.py
--- a/src/pyams_default_theme/viewlet/banner/__init__.py	Tue Jul 17 23:43:40 2018 +0200
+++ b/src/pyams_default_theme/viewlet/banner/__init__.py	Tue Jul 17 23:44:05 2018 +0200
@@ -35,4 +35,7 @@
     @property
     def settings(self):
         target = get_parent(self.context, IHeaderTarget)
-        return ISimpleHeaderRendererSettings(IHeaderSettings(target).settings, None)
+        settings = IHeaderSettings(target)
+        while settings.inherit:
+            settings = IHeaderSettings(settings.parent)
+        return ISimpleHeaderRendererSettings(settings.settings, None)
--- a/src/pyams_default_theme/viewlet/logo/__init__.py	Tue Jul 17 23:43:40 2018 +0200
+++ b/src/pyams_default_theme/viewlet/logo/__init__.py	Tue Jul 17 23:44:05 2018 +0200
@@ -12,6 +12,7 @@
 
 __docformat__ = 'restructuredtext'
 
+
 # import standard library
 
 # import interfaces
@@ -34,4 +35,7 @@
     @property
     def settings(self):
         target = get_parent(self.context, IHeaderTarget)
-        return ISimpleHeaderRendererSettings(IHeaderSettings(target).settings, None)
+        settings = IHeaderSettings(target)
+        while settings.inherit:
+            settings = IHeaderSettings(settings.parent)
+        return ISimpleHeaderRendererSettings(settings.settings, None)