Added update of header renderer
authorThierry Florac <thierry.florac@onf.fr>
Tue, 03 Jul 2018 14:33:51 +0200
changeset 67 af7c769f195d
parent 66 6c410c0ee25c
child 68 902e9f5dc296
Added update of header renderer
src/pyams_default_theme/features/header/__init__.py
--- a/src/pyams_default_theme/features/header/__init__.py	Tue Jul 03 12:18:33 2018 +0200
+++ b/src/pyams_default_theme/features/header/__init__.py	Tue Jul 03 14:33:51 2018 +0200
@@ -39,19 +39,21 @@
     """Header content provider"""
 
     header = None
+    renderer = None
 
     def update(self):
         parent = get_parent(self.context, IHeaderTarget)
         if parent is not None:
-            self.header = IHeaderSettings(parent, None)
+            header = self.header = IHeaderSettings(parent, None)
+            if header is not None:
+                renderer = self.renderer = header.get_renderer(self.request)
+                if renderer is not None:
+                    renderer.update()
 
     def render(self):
-        if self.header is None:
+        if (self.header is None) or (self.renderer is None):
             return ''
-        renderer = self.header.get_renderer(self.request)
-        if renderer is None:
-            return ''
-        return renderer.render()
+        return self.renderer.render()
 
 
 #