Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor optimization to disable Diazo theming via "X-Theme-Disabled" a tick earlier. #244

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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