fix: register theming context processor on CONTEXT_PROCESSORS for Verawood - #98
Merged
Merged
Conversation
…awood From Verawood onwards, TEMPLATES[*]['OPTIONS']['context_processors'] are Derived values instead of lists, so appending to them raised an AttributeError that was silently swallowed. As a result the `theming` context processor was never registered and every legacy Mako page failed with "AttributeError: 'Undefined' object has no attribute 'options'". Register the processor on CONTEXT_PROCESSORS instead, which both template engines derive from. This keeps compatibility with earlier releases (where both engines share the same CONTEXT_PROCESSORS list), adds a fallback for releases without a CONTEXT_PROCESSORS setting, and adds unit tests covering the registration paths. Bump version to 10.1.1 and update CHANGELOG and README compatibility notes.
jignaciopm
force-pushed
the
fix/verawood-context-processor-registration
branch
from
September 4, 2026 01:16
ef00b0c to
e582aa5
Compare
Gi-ron
approved these changes
Sep 4, 2026
MaferMazu
approved these changes
Sep 4, 2026
MaferMazu
left a comment
Contributor
There was a problem hiding this comment.
This looks good to me. Thanks ✨
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
From Verawood onwards, edx-platform builds its settings with the new Derived settings framework (
openedx/envs/common.py). As part of that change, each template engine'scontext_processorsis no longer a list but aDerivedvalue:plugin_settings()registered thethemingcontext processor by mutating those entries directly:On Verawood
.append()/inrun against aDerivedobject (which is not a list and not iterable), raisingAttributeError/TypeErrorthat was caught and only logged. The context processor was therefore never registered, leaving thethemingtemplate variable undefined and making every legacy Mako/Django page fail with:Fix
Register the context processor on
settings.CONTEXT_PROCESSORSinstead. Both the Django and Mako engines derive theircontext_processorsfrom this setting, so the change works across releases:context_processorsat the sameCONTEXT_PROCESSORSlist, so appending to it reaches both engines.Derivedvalues tosettings.CONTEXT_PROCESSORSwhenderive_settings()runs, picking up the appended processor.A fallback is kept for releases that don't expose a
CONTEXT_PROCESSORSsetting (registers on each engine whosecontext_processorsis still a plain list).No support for earlier releases is dropped.
Testing instructions
On a Verawood environment with
eox-theminginstalled and a comprehensive theme enabled (e.g.bragi/css-runtime), load any legacy Mako page (for example/404or the login page).AttributeError: 'Undefined' object has no attribute 'options'.theming.options(...)resolves.Run the unit tests:
make test-python # or, focused: DJANGO_SETTINGS_MODULE=eox_theming.settings.test pytest eox_theming/tests/test_settings.pyNew tests in
eox_theming/tests/test_settings.pycover: registration viaCONTEXT_PROCESSORS(Verawood/Derived), idempotency, the legacy shared-list path, and the no-CONTEXT_PROCESSORSfallback.Additional information
10.1.0→10.1.1, updatesCHANGELOG.md(Fixed) and the README compatibility notes (Verawood >= 10.1.1)._make_mako_template_dirs→make_mako_template_dirs(now inopenedx.envs.common).v10.1.0declared Verawood support but only updated dependencies/CI; this PR fixes the actual runtime regression.Tested in a remote environment
Checklist for Merge