Avoid re-applying skin when skin is inherited from parent
authorThierry Florac <thierry.florac@onf.fr>
Wed, 30 May 2018 15:05:59 +0200
changeset 331 a473eb11ed15
parent 330 d9e47bf8c17f
child 332 13c5ac0603dd
Avoid re-applying skin when skin is inherited from parent
src/pyams_skin/skin.py
--- a/src/pyams_skin/skin.py	Tue May 29 09:46:18 2018 +0200
+++ b/src/pyams_skin/skin.py	Wed May 30 15:05:59 2018 +0200
@@ -128,9 +128,11 @@
 def handle_content_skin(event):
     """Apply skin when traversing skinnable object"""
     request = event.request
-    skin = event.object.get_skin(request)
-    if skin is not None:
-        apply_skin(request, skin)
+    skinnable = event.object
+    if not skinnable.inherit_skin:
+        skin = skinnable.get_skin(request)
+        if skin is not None:
+            apply_skin(request, skin)
 
 
 @subscriber(IBeforeTraverseEvent, context_selector=ISiteRoot)