From e0597c0827fb4e392ccc69e63d912baf90b3823a Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Thu, 19 Nov 2026 12:39:07 -0500 Subject: [PATCH] fix: read CUSTOM_COURSES_EDX as a flat Django setting edx-platform has had every feature flag as a top-level setting since Ulmo, and the FEATURES dict is being removed along with the FeaturesProxy bridge that kept dict reads working: https://github.com/openedx/edx-platform/issues/37396 Read the flag with getattr on the flat name, with the same default as before, and define it flat in the test settings. Co-Authored-By: Claude Fable 5.1 --- src/platform_plugin_aspects/tests/test_utils.py | 2 +- src/platform_plugin_aspects/utils.py | 2 +- test_settings.py | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/platform_plugin_aspects/tests/test_utils.py b/src/platform_plugin_aspects/tests/test_utils.py index bed8e620..e635850f 100644 --- a/src/platform_plugin_aspects/tests/test_utils.py +++ b/src/platform_plugin_aspects/tests/test_utils.py @@ -94,7 +94,7 @@ def test_get_ccx_courses(self, mock_get_model): mock_model.objects.filter.assert_called_once_with(course_id="dummy_key") - @patch.object(settings, "FEATURES", {"CUSTOM_COURSES_EDX": False}) + @patch.object(settings, "CUSTOM_COURSES_EDX", False) def test_get_ccx_courses_feature_disabled(self): courses = get_ccx_courses("dummy_key") diff --git a/src/platform_plugin_aspects/utils.py b/src/platform_plugin_aspects/utils.py index 0783abe6..931abe1b 100644 --- a/src/platform_plugin_aspects/utils.py +++ b/src/platform_plugin_aspects/utils.py @@ -268,7 +268,7 @@ def get_ccx_courses(course_id): """ Get the CCX courses for a given course. """ - if settings.FEATURES.get("CUSTOM_COURSES_EDX"): + if getattr(settings, "CUSTOM_COURSES_EDX", False): return get_model("custom_course_edx").objects.filter(course_id=course_id) return [] diff --git a/test_settings.py b/test_settings.py index 03a8b45f..9265b65a 100644 --- a/test_settings.py +++ b/test_settings.py @@ -60,9 +60,7 @@ EVENT_SINK_CLICKHOUSE_COURSE_OVERVIEWS_ENABLED = True -FEATURES = { - "CUSTOM_COURSES_EDX": True, -} +CUSTOM_COURSES_EDX = True LMS_ROOT_URL = "https://lms.url"