Skip to content

Commit 8b5632c

Browse files
Copilotkiram15
andauthored
fix: add safe enterprise context defaults to prevent stale Mako cache crashes
Agent-Logs-Url: https://github.com/openedx/openedx-platform/sessions/9f1afa3c-8e4e-45be-b752-62cb9fd8bb5b Co-authored-by: kiram15 <31229189+kiram15@users.noreply.github.com>
1 parent 1f152ee commit 8b5632c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

common/djangoapps/student/views/dashboard.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,15 @@ def student_dashboard(request): # pylint: disable=too-many-statements
790790
context = {
791791
'urls': urls,
792792
'programs_data': programs_data,
793+
# These enterprise-related keys are populated by DashboardContextEnricher (via DashboardRenderStarted filter)
794+
# when the enterprise package is installed. Safe defaults are provided here so that:
795+
# 1. The template renders safely on non-enterprise deployments.
796+
# 2. Any stale compiled Mako cache that still references consent_required_courses (from before
797+
# PR #38094 removed that line) will not crash with "argument of type 'Undefined' is not iterable".
798+
'enterprise_message': '',
799+
'consent_required_courses': set(),
800+
'enterprise_learner_portal_enabled_message': None,
801+
'banner_account_activation_message': None,
793802
'enrollment_message': enrollment_message,
794803
'redirect_message': Text(redirect_message),
795804
'account_activation_messages': account_activation_messages,

lms/envs/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3292,7 +3292,7 @@ def _should_send_certificate_events(settings):
32923292
"pipeline": ["enterprise.filters.accounts.AccountSettingsReadOnlyFieldsStep"],
32933293
},
32943294
"org.openedx.learning.dashboard.render.started.v1": {
3295-
"fail_silently": False,
3295+
"fail_silently": True,
32963296
"pipeline": ["enterprise.filters.dashboard.DashboardContextEnricher"],
32973297
},
32983298
}

0 commit comments

Comments
 (0)