diff --git a/news/244.internal b/news/244.internal new file mode 100644 index 00000000..4fea9be5 --- /dev/null +++ b/news/244.internal @@ -0,0 +1,2 @@ +Minor optimization to disable Diazo theming via `X-Theme-Disabled` a tick earlier. +[thet] diff --git a/src/plone/app/theming/policy.py b/src/plone/app/theming/policy.py index d837ff22..227b7b4d 100644 --- a/src/plone/app/theming/policy.py +++ b/src/plone/app/theming/policy.py @@ -67,14 +67,14 @@ def getCurrentTheme(self): def isThemeEnabled(self, settings=None): """Whether theming is enabled.""" - # Resolve debug_mode late (i.e. not on import time) since it may - # be set during import or test setup time - debug_mode = getConfiguration().debug_mode - # Disable theming if the response sets a header if self.request.response.getHeader("X-Theme-Disabled"): return False + # Resolve debug_mode late (i.e. not on import time) since it may + # be set during import or test setup time + debug_mode = getConfiguration().debug_mode + # Check for diazo.off request parameter true_vals = ("1", "y", "yes", "t", "true") if debug_mode and self.request.get("diazo.off", "").lower() in true_vals: