Updated header renderer
authorThierry Florac <tflorac@ulthar.net>
Fri, 01 Feb 2019 18:37:24 +0100
changeset 414 89a7df9f7c79
parent 413 ca5dc86bf65f
child 415 998a2e82e10c
Updated header renderer
src/pyams_default_theme/features/header/skin/__init__.py
--- a/src/pyams_default_theme/features/header/skin/__init__.py	Fri Feb 01 18:33:44 2019 +0100
+++ b/src/pyams_default_theme/features/header/skin/__init__.py	Fri Feb 01 18:37:24 2019 +0100
@@ -88,19 +88,20 @@
         return get_reference_target(self.settings.search_target, request=self.request)
 
     def render(self):
+        request = self.request
+        context = request.context
         # root condition applies only when not displaying a shared content
-        if ISiteRoot.providedBy(self.request.context) and \
-                (self.request.display_context is None) and \
+        if ISiteRoot.providedBy(context) and \
                 not self.settings.can_apply_on_root:
             return ''
         # don't use cache in preview mode
-        preview_mode = self.request.annotations.get(PREVIEW_MODE, False)
+        preview_mode = request.annotations.get(PREVIEW_MODE, False)
         if preview_mode:
             return super(BaseHeaderRenderer, self).render()
         else:
             portlets_cache = get_cache(PORTLETS_CACHE_REGION, PORTLETS_CACHE_NAME)
             cache_key = self.cache_key
-            if self.context is not self.request.context:  # display shared content
+            if context is not self.context:  # display shared content
                 cache_key = '{0}::shared'.format(cache_key)
             try:
                 result = portlets_cache.get_value(cache_key)