refactor: migrate ENABLE_EXAM_SETTINGS_HTML_VIEW and LICENSING off FEATURES-as-dict - #39017
Draft
feanil wants to merge 2 commits into
Draft
refactor: migrate ENABLE_EXAM_SETTINGS_HTML_VIEW and LICENSING off FEATURES-as-dict#39017feanil wants to merge 2 commits into
feanil wants to merge 2 commits into
Conversation
xmodule/course_block.py read this flag via
getattr(settings, 'FEATURES', {}).get('ENABLE_EXAM_SETTINGS_HTML_VIEW', False) to decide
whether the legacy proctored/timed-exam CourseBlock fields are marked deprecated in the
advanced settings editor. The flag had no flat definition anywhere.
Add an annotated ENABLE_EXAM_SETTINGS_HTML_VIEW = False to openedx/envs/common.py and read
it with getattr(settings, 'ENABLE_EXAM_SETTINGS_HTML_VIEW', False) -- matching the adjacent
DEFAULT_MOBILE_AVAILABLE / ENABLE_SPECIAL_EXAMS readers. getattr is kept (rather than bare
settings.X) because this module is imported in contexts where settings may not be fully
configured, e.g. static asset compilation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lms/envs/production.py and cms/envs/production.py set XBLOCK_SETTINGS["VideoBlock"]["licensing_enabled"] from FEATURES["LICENSING"]. LICENSING is a flat setting (defined in openedx/envs/common.py) and is available in these modules through the common star-import, so read it directly instead of through the FEATURES dict. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Two production/settings readers that still went through the
FEATURESdict.ENABLE_EXAM_SETTINGS_HTML_VIEW—xmodule/course_block.pyread it viagetattr(settings, 'FEATURES', {}).get('ENABLE_EXAM_SETTINGS_HTML_VIEW', False)to mark the legacy proctored/timed-examCourseBlockfields as deprecated. It had no flat definition, so this adds an annotatedENABLE_EXAM_SETTINGS_HTML_VIEW = Falsetoopenedx/envs/common.pyand reads it viagetattr(settings, 'ENABLE_EXAM_SETTINGS_HTML_VIEW', False)— matching the adjacentDEFAULT_MOBILE_AVAILABLE/ENABLE_SPECIAL_EXAMSreaders (getattr kept because the module is imported in contexts where settings may not be configured, e.g. asset compilation).LICENSING—lms/envs/production.pyandcms/envs/production.pysetXBLOCK_SETTINGS["VideoBlock"]["licensing_enabled"]fromFEATURES["LICENSING"].LICENSINGis a flat setting (openedx/envs/common.py) available via the common star-import, so read it directly.Verified:
xmodule/tests/test_course_block.pypasses (33); reloadingcourse_blockunder@override_settings(ENABLE_EXAM_SETTINGS_HTML_VIEW=True)yieldsEXAM_SETTINGS_HTML_VIEW_ENABLED == True;ruffclean. Operator configs that set these viaFEATURES:YAML continue to work through the productionFEATURES:-to-settings loop.