Skip to content

Commit

Permalink
Merge pull request #244 from plone/thet-minor-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki authored Sep 4, 2024
2 parents fa8a76a + 61ef90d commit 0f5a53f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions news/244.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Minor optimization to disable Diazo theming via `X-Theme-Disabled` a tick earlier.
[thet]
8 changes: 4 additions & 4 deletions src/plone/app/theming/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0f5a53f

Please sign in to comment.