diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 58cd39a80868..79a59d2a0f19 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -20,6 +20,7 @@ jobs: name: ${{ matrix.shard_name }}(py=${{ matrix.python-version }},dj=${{ matrix.django-version }},mongo=${{ matrix.mongo-version }}) runs-on: ${{ matrix.os-version }} strategy: + fail-fast: false matrix: python-version: - "3.11" diff --git a/cms/djangoapps/cms_user_tasks/tests.py b/cms/djangoapps/cms_user_tasks/tests.py index 8a9bc5532101..d87aeaedb6d3 100644 --- a/cms/djangoapps/cms_user_tasks/tests.py +++ b/cms/djangoapps/cms_user_tasks/tests.py @@ -277,7 +277,7 @@ def test_email_sent_with_olx_validations_with_default_config(self): msg = mail.outbox[0] # Verify olx validation is not enabled out of the box. - self.assertFalse(settings.FEATURES.get('ENABLE_COURSE_OLX_VALIDATION')) + self.assertFalse(settings.ENABLE_COURSE_OLX_VALIDATION) self.assertEqual(len(mail.outbox), 1) self.assert_msg_subject(msg) self.assert_msg_body_fragments(msg, body_fragments) diff --git a/cms/djangoapps/contentstore/courseware_index.py b/cms/djangoapps/contentstore/courseware_index.py index b7b74992035a..7dd35f820301 100644 --- a/cms/djangoapps/contentstore/courseware_index.py +++ b/cms/djangoapps/contentstore/courseware_index.py @@ -49,7 +49,7 @@ def indexing_is_enabled(): """ Checks to see if the indexing feature is enabled """ - return settings.FEATURES.get('ENABLE_COURSEWARE_INDEX', False) + return settings.ENABLE_COURSEWARE_INDEX class SearchIndexingError(Exception): diff --git a/cms/djangoapps/contentstore/exams.py b/cms/djangoapps/contentstore/exams.py index 8a4ddc09425e..d54f5233d441 100644 --- a/cms/djangoapps/contentstore/exams.py +++ b/cms/djangoapps/contentstore/exams.py @@ -27,7 +27,7 @@ def register_exams(course_key): Likewise, if formerly registered exams are not included in the payload they will be marked inactive by the exam service. """ - if not settings.FEATURES.get('ENABLE_SPECIAL_EXAMS') or not exams_ida_enabled(course_key): + if not settings.ENABLE_SPECIAL_EXAMS or not exams_ida_enabled(course_key): # if feature is not enabled then do a quick exit return diff --git a/cms/djangoapps/contentstore/management/commands/reindex_course.py b/cms/djangoapps/contentstore/management/commands/reindex_course.py index 0bd52b6cc16e..ba0acb5fc308 100644 --- a/cms/djangoapps/contentstore/management/commands/reindex_course.py +++ b/cms/djangoapps/contentstore/management/commands/reindex_course.py @@ -143,7 +143,7 @@ def handle(self, *args, **options): # pylint: disable=too-many-statements all_courses = modulestore().get_courses() inclusion_date = datetime.strptime( - settings.FEATURES.get('COURSEWARE_SEARCH_INCLUSION_DATE', '2020-01-01'), + settings.COURSEWARE_SEARCH_INCLUSION_DATE or '2020-01-01', '%Y-%m-%d' ) diff --git a/cms/djangoapps/contentstore/proctoring.py b/cms/djangoapps/contentstore/proctoring.py index bd33049006c4..bd2f9bf5a0a0 100644 --- a/cms/djangoapps/contentstore/proctoring.py +++ b/cms/djangoapps/contentstore/proctoring.py @@ -35,7 +35,7 @@ def register_special_exams(course_key): subsystem. Likewise, if formerly registered exams are unmarked, then those registered exams are marked as inactive """ - if not settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'): + if not settings.ENABLE_SPECIAL_EXAMS: # if feature is not enabled then do a quick exit return diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/grading.py b/cms/djangoapps/contentstore/rest_api/v1/views/grading.py index 9275fecb58ab..90e7508d14e2 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/grading.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/grading.py @@ -96,7 +96,7 @@ def get(self, request: Request, course_id: str): self.permission_denied(request) with modulestore().bulk_operations(course_key): - credit_eligibility_enabled = settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY", False) + credit_eligibility_enabled = settings.ENABLE_CREDIT_ELIGIBILITY show_credit_eligibility = is_credit_course(course_key) and credit_eligibility_enabled grading_context = get_course_grading(course_key) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/home.py b/cms/djangoapps/contentstore/rest_api/v1/views/home.py index 95723020c11f..3ae512ce3b14 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/home.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/home.py @@ -90,7 +90,7 @@ def get(self, request: Request): ), 'studio_name': settings.STUDIO_NAME, 'studio_short_name': settings.STUDIO_SHORT_NAME, - 'studio_request_email': settings.FEATURES.get('STUDIO_REQUEST_EMAIL', ''), + 'studio_request_email': settings.STUDIO_REQUEST_EMAIL, 'tech_support_email': settings.TECH_SUPPORT_EMAIL, 'platform_name': settings.PLATFORM_NAME, 'user_is_active': request.user.is_active, diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/proctoring.py b/cms/djangoapps/contentstore/rest_api/v1/views/proctoring.py index 28296513a5e6..01f65b0d2c5e 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/proctoring.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/proctoring.py @@ -266,7 +266,7 @@ def get(self, request: Request, course_id: str) -> Response: course_block = modulestore().get_course(course_key) advanced_dict = CourseMetadata.fetch(course_block) - if settings.FEATURES.get('DISABLE_MOBILE_COURSE_AVAILABLE', False): + if settings.DISABLE_MOBILE_COURSE_AVAILABLE: advanced_dict.get('mobile_available')['deprecated'] = True proctoring_errors = CourseMetadata.validate_proctoring_settings(course_block, advanced_dict, request.user) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/settings.py b/cms/djangoapps/contentstore/rest_api/v1/views/settings.py index fbb05cba4de2..12903428f498 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/settings.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/settings.py @@ -110,7 +110,7 @@ def get(self, request: Request, course_id: str): 'course_display_name': course_block.display_name, 'course_display_name_with_default': course_block.display_name_with_default, 'platform_name': settings.PLATFORM_NAME, - 'licensing_enabled': settings.FEATURES.get("LICENSING", False), + 'licensing_enabled': settings.LICENSING, }) serializer = CourseSettingsSerializer(settings_context) diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index 876bb37ee783..cbab9591e261 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -437,7 +437,7 @@ def test_marketing_site_fetch(self): self.assertNotContains(response, "Course Banner Image") self.assertNotContains(response, "Course Video Thumbnail Image") - @unittest.skipUnless(settings.FEATURES.get('ENTRANCE_EXAMS', False), True) + @unittest.skipUnless(settings.ENTRANCE_EXAMS, True) def test_entrance_exam_created_updated_and_deleted_successfully(self): """ This tests both of the entrance exam settings and the `any_unfulfilled_milestones` helper. @@ -503,7 +503,7 @@ def test_entrance_exam_created_updated_and_deleted_successfully(self): self.assertFalse(milestones_helpers.any_unfulfilled_milestones(self.course.id, self.user.id), msg='The entrance exam should not be required anymore') - @unittest.skipUnless(settings.FEATURES.get('ENTRANCE_EXAMS', False), True) + @unittest.skipUnless(settings.ENTRANCE_EXAMS, True) def test_entrance_exam_store_default_min_score(self): """ test that creating an entrance exam should store the default value, if key missing in json request @@ -557,7 +557,7 @@ def test_entrance_exam_store_default_min_score(self): self.assertTrue(course.entrance_exam_enabled) self.assertEqual(course.entrance_exam_minimum_score_pct, .5) - @unittest.skipUnless(settings.FEATURES.get('ENTRANCE_EXAMS', False), True) + @unittest.skipUnless(settings.ENTRANCE_EXAMS, True) @mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PREREQUISITE_COURSES': True}) def test_entrance_after_changing_other_setting(self): """ diff --git a/cms/djangoapps/contentstore/toggles.py b/cms/djangoapps/contentstore/toggles.py index 7aadfe64e94d..90f3bf41d6d5 100644 --- a/cms/djangoapps/contentstore/toggles.py +++ b/cms/djangoapps/contentstore/toggles.py @@ -1,7 +1,9 @@ """ CMS feature toggles. """ +from django.conf import settings from edx_toggles.toggles import SettingToggle, WaffleFlag + from openedx.core.djangoapps.content.search import api as search_api from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag @@ -409,25 +411,11 @@ def default_enable_flexible_peer_openassessments(course_key): return DEFAULT_ENABLE_FLEXIBLE_PEER_OPENASSESSMENTS.is_enabled(course_key) -# .. toggle_name: ENABLE_CONTENT_LIBRARIES -# .. toggle_implementation: SettingToggle -# .. toggle_default: True -# .. toggle_description: Enables use of the legacy and v2 libraries waffle flags. -# Note that legacy content libraries are only supported in courses using split mongo. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2015-03-06 -# .. toggle_target_removal_date: 2025-04-09 -# .. toggle_warning: This flag is deprecated in Sumac, and will be removed in favor of the disable_legacy_libraries and -# disable_new_libraries waffle flags. -ENABLE_CONTENT_LIBRARIES = SettingToggle( - "ENABLE_CONTENT_LIBRARIES", default=True, module_name=__name__ -) - # .. toggle_name: contentstore.new_studio_mfe.disable_legacy_libraries # .. toggle_implementation: WaffleFlag # .. toggle_default: False # .. toggle_description: Hides legacy (v1) Libraries tab in Authoring MFE. -# This toggle interacts with ENABLE_CONTENT_LIBRARIES toggle: if this is disabled, then legacy libraries are also +# This toggle interacts with ENABLE_CONTENT_LIBRARIES setting: if this is disabled, then legacy libraries are also # disabled. # .. toggle_use_cases: open_edx # .. toggle_creation_date: 2024-10-02 @@ -446,7 +434,7 @@ def libraries_v1_enabled(): Returns a boolean if Libraries V2 is enabled in the new Studio Home. """ return ( - ENABLE_CONTENT_LIBRARIES.is_enabled() and + settings.ENABLE_CONTENT_LIBRARIES and not DISABLE_LEGACY_LIBRARIES.is_enabled() ) @@ -476,7 +464,7 @@ def libraries_v2_enabled(): Requires the ENABLE_CONTENT_LIBRARIES feature flag to be enabled, plus Meilisearch. """ return ( - ENABLE_CONTENT_LIBRARIES.is_enabled() and + settings.ENABLE_CONTENT_LIBRARIES and search_api.is_meilisearch_enabled() and not DISABLE_NEW_LIBRARIES.is_enabled() ) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index f40fad42152c..a6c9cc6d36d9 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -571,7 +571,7 @@ def course_import_olx_validation_is_enabled(): """ Check if course olx validation is enabled on course import. """ - return settings.FEATURES.get('ENABLE_COURSE_OLX_VALIDATION', False) + return settings.ENABLE_COURSE_OLX_VALIDATION # pylint: disable=invalid-name @@ -1409,7 +1409,7 @@ def get_course_settings(request, course_key, course_block): from .views.course import get_courses_accessible_to_user, _process_courses_list - credit_eligibility_enabled = settings.FEATURES.get('ENABLE_CREDIT_ELIGIBILITY', False) + credit_eligibility_enabled = settings.ENABLE_CREDIT_ELIGIBILITY upload_asset_url = reverse_course_url('assets_handler', course_key) # see if the ORG of this course can be attributed to a defined configuration . In that case, the @@ -1417,17 +1417,17 @@ def get_course_settings(request, course_key, course_block): publisher_enabled = configuration_helpers.get_value_for_org( course_block.location.org, 'ENABLE_PUBLISHER', - settings.FEATURES.get('ENABLE_PUBLISHER', False) + settings.ENABLE_PUBLISHER ) marketing_enabled = configuration_helpers.get_value_for_org( course_block.location.org, 'ENABLE_MKTG_SITE', - settings.FEATURES.get('ENABLE_MKTG_SITE', False) + settings.ENABLE_MKTG_SITE ) enable_extended_course_details = configuration_helpers.get_value_for_org( course_block.location.org, 'ENABLE_EXTENDED_COURSE_DETAILS', - settings.FEATURES.get('ENABLE_EXTENDED_COURSE_DETAILS', False) + settings.ENABLE_EXTENDED_COURSE_DETAILS ) about_page_editable = not publisher_enabled @@ -1435,7 +1435,7 @@ def get_course_settings(request, course_key, course_block): short_description_editable = configuration_helpers.get_value_for_org( course_block.location.org, 'EDITABLE_SHORT_DESCRIPTION', - settings.FEATURES.get('EDITABLE_SHORT_DESCRIPTION', True) + settings.EDITABLE_SHORT_DESCRIPTION ) sidebar_html_enabled = ENABLE_COURSE_ABOUT_SIDEBAR_HTML.is_enabled() @@ -1623,9 +1623,9 @@ def get_library_context(request, request_is_json=False): 'user': request.user, 'request_course_creator_url': reverse('request_course_creator'), 'course_creator_status': _get_course_creator_status(request.user), - 'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False), + 'allow_unicode_course_id': settings.ALLOW_UNICODE_COURSE_ID, 'archived_courses': True, - 'allow_course_reruns': settings.FEATURES.get('ALLOW_COURSE_RERUNS', True), + 'allow_course_reruns': settings.ALLOW_COURSE_RERUNS, 'rerun_creator_status': GlobalStaff().has_user(request.user), 'split_studio_home': split_library_view_on_dashboard(), 'active_tab': 'libraries', @@ -1670,7 +1670,7 @@ def format_in_process_course_view(uca): } courses_iter, in_process_course_actions = get_courses_accessible_to_user(request) - split_archived = settings.FEATURES.get('ENABLE_SEPARATE_ARCHIVED_COURSES', False) + split_archived = settings.ENABLE_SEPARATE_ARCHIVED_COURSES active_courses, archived_courses = _process_courses_list(courses_iter, in_process_course_actions, split_archived) in_process_course_actions = [format_in_process_course_view(uca) for uca in in_process_course_actions] return active_courses, archived_courses, in_process_course_actions @@ -1763,8 +1763,8 @@ def get_home_context(request, no_course=False): 'request_course_creator_url': reverse('request_course_creator'), 'course_creator_status': _get_course_creator_status(user), 'rerun_creator_status': GlobalStaff().has_user(user), - 'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False), - 'allow_course_reruns': settings.FEATURES.get('ALLOW_COURSE_RERUNS', True), + 'allow_unicode_course_id': settings.ALLOW_UNICODE_COURSE_ID, + 'allow_course_reruns': settings.ALLOW_COURSE_RERUNS, 'active_tab': 'courses', 'allowed_organizations': get_allowed_organizations(user), 'allowed_organizations_for_libraries': get_allowed_organizations_for_libraries(user), @@ -1788,7 +1788,7 @@ def get_course_rerun_context(course_key, course_block, user): 'display_name': course_block.display_name, 'user': user, 'course_creator_status': _get_course_creator_status(user), - 'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False) + 'allow_unicode_course_id': settings.ALLOW_UNICODE_COURSE_ID } return course_rerun_context @@ -1910,7 +1910,7 @@ def _get_course_index_context(request, course_key, course_block): lms_link = get_lms_link_for_item(course_block.location) reindex_link = None - if settings.FEATURES.get('ENABLE_COURSEWARE_INDEX', False): + if settings.ENABLE_COURSEWARE_INDEX: if GlobalStaff().has_user(request.user): reindex_link = f"/course/{str(course_key)}/search_reindex" sections = course_block.get_children() @@ -1936,7 +1936,7 @@ def _get_course_index_context(request, course_key, course_block): frontend_app_publisher_url = configuration_helpers.get_value_for_org( course_block.location.org, 'FRONTEND_APP_PUBLISHER_URL', - settings.FEATURES.get('FRONTEND_APP_PUBLISHER_URL', False) + settings.FRONTEND_APP_PUBLISHER_URL ) # gather any errors in the currently stored proctoring settings. advanced_dict = CourseMetadata.fetch(course_block) diff --git a/cms/djangoapps/contentstore/video_storage_handlers.py b/cms/djangoapps/contentstore/video_storage_handlers.py index 46215ae90362..26a745809f8d 100644 --- a/cms/djangoapps/contentstore/video_storage_handlers.py +++ b/cms/djangoapps/contentstore/video_storage_handlers.py @@ -577,7 +577,7 @@ def _get_and_validate_course(course_key_string, user): course = get_course_and_check_access(course_key, user) if ( - settings.FEATURES["ENABLE_VIDEO_UPLOAD_PIPELINE"] and + settings.ENABLE_VIDEO_UPLOAD_PIPELINE and getattr(settings, "VIDEO_UPLOAD_PIPELINE", None) and course and course.video_pipeline_configured diff --git a/cms/djangoapps/contentstore/views/certificate_manager.py b/cms/djangoapps/contentstore/views/certificate_manager.py index 081afdcc0dd7..6e7419a39dc7 100644 --- a/cms/djangoapps/contentstore/views/certificate_manager.py +++ b/cms/djangoapps/contentstore/views/certificate_manager.py @@ -122,7 +122,7 @@ def is_activated(course): """ is_active = False certificates = [] - if settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False): + if settings.CERTIFICATES_HTML_VIEW: certificates = CertificateManager.get_certificates(course) # we are assuming only one certificate in certificates collection. for certificate in certificates: diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index bf2cd9cb83d6..7ba3d90f967e 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -883,7 +883,7 @@ def _create_or_rerun_course(request): raise PermissionDenied() # allow/disable unicode characters in course_id according to settings - if not settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID'): + if not settings.ALLOW_UNICODE_COURSE_ID: if _has_non_ascii_characters(org) or _has_non_ascii_characters(course) or _has_non_ascii_characters(run): return JsonResponse( {'error': _('Special characters not allowed in organization, course number, and course run.')}, @@ -1285,7 +1285,7 @@ def advanced_settings_handler(request, course_key_string): course_block = get_course_and_check_access(course_key, request.user) advanced_dict = CourseMetadata.fetch(course_block) - if settings.FEATURES.get('DISABLE_MOBILE_COURSE_AVAILABLE', False): + if settings.DISABLE_MOBILE_COURSE_AVAILABLE: advanced_dict.get('mobile_available')['deprecated'] = True if 'text/html' in request.META.get('HTTP_ACCEPT', '') and request.method == 'GET': @@ -1294,7 +1294,7 @@ def advanced_settings_handler(request, course_key_string): publisher_enabled = configuration_helpers.get_value_for_org( course_block.location.org, 'ENABLE_PUBLISHER', - settings.FEATURES.get('ENABLE_PUBLISHER', False) + settings.ENABLE_PUBLISHER ) # gather any errors in the currently stored proctoring settings. proctoring_errors = CourseMetadata.validate_proctoring_settings(course_block, advanced_dict, request.user) @@ -1803,9 +1803,9 @@ def _get_course_creator_status(user): if user.is_staff: course_creator_status = 'granted' - elif settings.FEATURES.get('DISABLE_COURSE_CREATION', False): + elif settings.DISABLE_COURSE_CREATION: course_creator_status = 'disallowed_for_this_site' - elif settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): + elif settings.ENABLE_CREATOR_GROUP: course_creator_status = get_course_creator_status(user) if course_creator_status is None: # User not grandfathered in as an existing user, has not previously visited the dashboard page. @@ -1822,7 +1822,7 @@ def get_allowed_organizations(user): """ Helper method for returning the list of organizations for which the user is allowed to create courses. """ - if settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): + if settings.ENABLE_CREATOR_GROUP: return get_organizations(user) else: return [] @@ -1837,12 +1837,12 @@ def get_allowed_organizations_for_libraries(user): # This allows org-level staff to create libraries. We should re-evaluate # whether this is necessary and try to normalize course and library creation # authorization behavior. - if settings.FEATURES.get('ENABLE_ORGANIZATION_STAFF_ACCESS_FOR_CONTENT_LIBRARIES', False): + if settings.ENABLE_ORGANIZATION_STAFF_ACCESS_FOR_CONTENT_LIBRARIES: organizations_set.update(get_organizations_for_non_course_creators(user)) # This allows people in the course creator group for an org to create # libraries, which mimics course behavior. - if settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): + if settings.ENABLE_CREATOR_GROUP: organizations_set.update(get_organizations(user)) return sorted(organizations_set) @@ -1852,7 +1852,7 @@ def user_can_create_organizations(user): """ Returns True if the user can create organizations. """ - return user.is_staff or not settings.FEATURES.get('ENABLE_CREATOR_GROUP', False) + return user.is_staff or not settings.ENABLE_CREATOR_GROUP def get_organizations_for_non_course_creators(user): diff --git a/cms/djangoapps/contentstore/views/library.py b/cms/djangoapps/contentstore/views/library.py index 92e4329c2f94..09f90c10aa42 100644 --- a/cms/djangoapps/contentstore/views/library.py +++ b/cms/djangoapps/contentstore/views/library.py @@ -72,7 +72,7 @@ def _user_can_create_library_for_org(user, org=None): return False elif user.is_staff: return True - elif settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): + elif settings.ENABLE_CREATOR_GROUP: org_filter_params = {} if org: org_filter_params['org'] = org @@ -93,8 +93,8 @@ def _user_can_create_library_for_org(user, org=None): return is_course_creator or has_org_staff_role or has_course_staff_role or has_course_admin_role else: # EDUCATOR-1924: DISABLE_LIBRARY_CREATION overrides DISABLE_COURSE_CREATION, if present. - disable_library_creation = settings.FEATURES.get('DISABLE_LIBRARY_CREATION', None) - disable_course_creation = settings.FEATURES.get('DISABLE_COURSE_CREATION', False) + disable_library_creation = settings.DISABLE_LIBRARY_CREATION + disable_course_creation = settings.DISABLE_COURSE_CREATION if disable_library_creation is not None: return not disable_library_creation else: diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index 6600430a7a89..c7e7f70bce65 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -191,7 +191,7 @@ def _prepare_runtime_for_preview(request, block): ] mako_service = MakoService(namespace_prefix='lms.') - if settings.FEATURES.get("LICENSING", False): + if settings.LICENSING: # stick the license wrapper in front wrappers.insert(0, partial(wrap_with_license, mako_service=mako_service)) diff --git a/cms/djangoapps/contentstore/views/tests/test_videos.py b/cms/djangoapps/contentstore/views/tests/test_videos.py index e42ef2198c8d..a950927fe135 100644 --- a/cms/djangoapps/contentstore/views/tests/test_videos.py +++ b/cms/djangoapps/contentstore/views/tests/test_videos.py @@ -217,7 +217,7 @@ class VideoPipelineStudioAccessTestsMixin: Access tests for video views that rely on the video pipeline """ def test_video_pipeline_not_enabled(self): - settings.FEATURES["ENABLE_VIDEO_UPLOAD_PIPELINE"] = False + settings.ENABLE_VIDEO_UPLOAD_PIPELINE = False self.assertEqual(self.client.get(self.url).status_code, 404) def test_video_pipeline_not_configured(self): diff --git a/cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py b/cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py index f7c96d588a2e..f2d6f15fa828 100644 --- a/cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py +++ b/cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py @@ -1230,7 +1230,7 @@ def create_xblock_info( # lint-amnesty, pylint: disable=too-many-statements "user_partitions": user_partitions, "show_correctness": xblock.show_correctness, "hide_from_toc": xblock.hide_from_toc, - "enable_hide_from_toc_ui": settings.FEATURES.get("ENABLE_HIDE_FROM_TOC_UI", False), + "enable_hide_from_toc_ui": settings.ENABLE_HIDE_FROM_TOC_UI, "xblock_type": get_icon(xblock), } ) @@ -1268,7 +1268,7 @@ def create_xblock_info( # lint-amnesty, pylint: disable=too-many-statements ) # update xblock_info with special exam information if the feature flag is enabled - if settings.FEATURES.get("ENABLE_SPECIAL_EXAMS"): + if settings.ENABLE_SPECIAL_EXAMS: if xblock.category == "course": xblock_info.update( { diff --git a/cms/djangoapps/course_creators/admin.py b/cms/djangoapps/course_creators/admin.py index a1d34b3897fc..e6f0cb540265 100644 --- a/cms/djangoapps/course_creators/admin.py +++ b/cms/djangoapps/course_creators/admin.py @@ -142,7 +142,7 @@ def send_user_notification_callback(sender, **kwargs): # pylint: disable=unused user = kwargs['user'] updated_state = kwargs['state'] - studio_request_email = settings.FEATURES.get('STUDIO_REQUEST_EMAIL', '') + studio_request_email = settings.STUDIO_REQUEST_EMAIL context = {'studio_request_email': studio_request_email} subject = render_to_string('emails/course_creator_subject.txt', context) @@ -169,7 +169,7 @@ def send_admin_notification_callback(sender, **kwargs): # pylint: disable=unuse """ user = kwargs['user'] - studio_request_email = settings.FEATURES.get('STUDIO_REQUEST_EMAIL', '') + studio_request_email = settings.STUDIO_REQUEST_EMAIL context = {'user_name': user.username, 'user_email': user.email} subject = render_to_string('emails/course_creator_admin_subject.txt', context) diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py index c66f5b65e4c9..6c5d7ff3f641 100644 --- a/cms/djangoapps/models/settings/course_metadata.py +++ b/cms/djangoapps/models/settings/course_metadata.py @@ -103,19 +103,19 @@ def get_exclude_list_of_fields(cls, course_key): exclude_list.append('giturl') # Do not show edxnotes if the feature is disabled. - if not settings.FEATURES.get('ENABLE_EDXNOTES'): + if not settings.ENABLE_EDXNOTES: exclude_list.append('edxnotes') # Do not show video auto advance if the feature is disabled - if not settings.FEATURES.get('ENABLE_OTHER_COURSE_SETTINGS'): + if not settings.ENABLE_OTHER_COURSE_SETTINGS: exclude_list.append('other_course_settings') # Do not show video_upload_pipeline if the feature is disabled. - if not settings.FEATURES.get('ENABLE_VIDEO_UPLOAD_PIPELINE'): + if not settings.ENABLE_VIDEO_UPLOAD_PIPELINE: exclude_list.append('video_upload_pipeline') # Do not show video auto advance if the feature is disabled - if not settings.FEATURES.get('ENABLE_AUTOADVANCE_VIDEOS'): + if not settings.ENABLE_AUTOADVANCE_VIDEOS: exclude_list.append('video_auto_advance') # Do not show social sharing url field if the feature is disabled. @@ -124,14 +124,14 @@ def get_exclude_list_of_fields(cls, course_key): exclude_list.append('social_sharing_url') # Do not show teams configuration if feature is disabled. - if not settings.FEATURES.get('ENABLE_TEAMS'): + if not settings.ENABLE_TEAMS: exclude_list.append('teams_configuration') - if not settings.FEATURES.get('ENABLE_VIDEO_BUMPER'): + if not settings.ENABLE_VIDEO_BUMPER: exclude_list.append('video_bumper') # Do not show enable_ccx if feature is not enabled. - if not settings.FEATURES.get('CUSTOM_COURSES_EDX'): + if not settings.CUSTOM_COURSES_EDX: exclude_list.append('enable_ccx') exclude_list.append('ccx_connector') diff --git a/cms/envs/common.py b/cms/envs/common.py index f4f6fd8b9c9d..b88375a17372 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -82,10 +82,6 @@ # Segment - must explicitly turn it on for production CMS_SEGMENT_KEY = None -# If set to True, new Studio users won't be able to author courses unless -# an Open edX admin has added them to the course creator group. -ENABLE_CREATOR_GROUP = True - # If set to True, organization staff members can create libraries for their specific # organization and no other organizations. They do not need to be course creators, # even when ENABLE_CREATOR_GROUP is True. @@ -120,19 +116,6 @@ # course and that can be read from themes ENABLE_OTHER_COURSE_SETTINGS = False -# Enable support for content libraries. Note that content libraries are -# only supported in courses using split mongo. -ENABLE_CONTENT_LIBRARIES = True - -# .. toggle_name: settings.ENABLE_CONTENT_LIBRARIES_LTI_TOOL -# .. toggle_implementation: DjangoSetting -# .. toggle_default: False -# .. toggle_description: When set to True, Content Libraries in -# Studio can be used as an LTI 1.3 tool by external LTI platforms. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2021-08-17 -# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/27411 -ENABLE_CONTENT_LIBRARIES_LTI_TOOL = False # Toggle course entrance exams feature ENTRANCE_EXAMS = False @@ -238,14 +221,6 @@ # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/33952 ENABLE_HIDE_FROM_TOC_UI = False -# .. toggle_name: settings.IN_CONTEXT_DISCUSSION_ENABLED_DEFAULT -# .. toggle_implementation: DjangoSetting -# .. toggle_default: True -# .. toggle_description: Set to False to disable in-context discussion for units by default. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2024-09-02 -IN_CONTEXT_DISCUSSION_ENABLED_DEFAULT = True - # .. toggle_name: ENABLE_COPPA_COMPLIANCE # .. toggle_implementation: DjangoSetting # .. toggle_default: False diff --git a/cms/templates/howitworks.html b/cms/templates/howitworks.html index d21dff2d66a5..e12671bca16b 100644 --- a/cms/templates/howitworks.html +++ b/cms/templates/howitworks.html @@ -154,7 +154,7 @@

${_("Work in Teams")}

-% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True): +% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.ALLOW_PUBLIC_ACCOUNT_CREATION) and settings.SHOW_REGISTRATION_LINKS:
diff --git a/cms/templates/settings.html b/cms/templates/settings.html index df64bcc39361..fb17f9fa3dd2 100644 --- a/cms/templates/settings.html +++ b/cms/templates/settings.html @@ -664,7 +664,7 @@

${_("Entrance Exam")}

% endif - % if settings.FEATURES.get("LICENSING", False): + % if settings.LICENSING:
diff --git a/cms/templates/settings_graders.html b/cms/templates/settings_graders.html index eb0a057b046e..90673e9d69f3 100644 --- a/cms/templates/settings_graders.html +++ b/cms/templates/settings_graders.html @@ -91,7 +91,7 @@

${_("Overall Grade Range")}


- % if settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY", False) and is_credit_course: + % if settings.ENABLE_CREDIT_ELIGIBILITY and is_credit_course:

${_("Credit Eligibility")}

diff --git a/cms/templates/visibility_editor.html b/cms/templates/visibility_editor.html index 606a0c5ce368..62fcafe5b6d0 100644 --- a/cms/templates/visibility_editor.html +++ b/cms/templates/visibility_editor.html @@ -24,7 +24,7 @@

${_('Access is not restricted')}

% else:

${_('Access to this component is not restricted, but visibility might be affected by inherited settings.')}

%endif - % if settings.FEATURES.get('ENABLE_ENROLLMENT_TRACK_USER_PARTITION'): + % if settings.ENABLE_ENROLLMENT_TRACK_USER_PARTITION: % if block_is_unit:

${_('You can restrict access to this unit to learners in specific enrollment tracks or content groups.')}

% else: diff --git a/cms/templates/widgets/deprecated-course-key-warning.html b/cms/templates/widgets/deprecated-course-key-warning.html index 33de5e8d6465..3db76a2fc84a 100644 --- a/cms/templates/widgets/deprecated-course-key-warning.html +++ b/cms/templates/widgets/deprecated-course-key-warning.html @@ -9,7 +9,7 @@ from openedx.core.djangolib.translation_utils import translate_date DEFAULT_LANGUAGE = getattr(settings, 'LANGUAGE_CODE', 'en') -IS_ENABLED = settings.FEATURES.get('DEPRECATE_OLD_COURSE_KEYS_IN_STUDIO', True) +IS_ENABLED = settings.DEPRECATE_OLD_COURSE_KEYS_IN_STUDIO %> <% is_visible = IS_ENABLED and course and course.id.deprecated diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 4a8c7a142a86..6b3fb2ca46fb 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -42,7 +42,7 @@

advanced_settings_url = reverse('advanced_settings_handler', kwargs={'course_key_string': str(course_key)}) tabs_url = reverse('tabs_handler', kwargs={'course_key_string': str(course_key)}) certificates_url = '' - if settings.FEATURES.get("CERTIFICATES_HTML_VIEW") and context_course.cert_html_view_enabled: + if settings.CERTIFICATES_HTML_VIEW and context_course.cert_html_view_enabled: certificates_url = reverse('certificates_list_handler', kwargs={'course_key_string': str(course_key)}) checklists_url = reverse('checklists_handler', kwargs={'course_key_string': str(course_key)}) pages_and_resources_mfe_enabled = ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(context_course.id) @@ -309,7 +309,7 @@

${_("Tools")}

${_("Account Navigation")}

    - % if settings.FEATURES.get('ENABLE_HELP_LINK'): + % if settings.ENABLE_HELP_LINK: @@ -324,12 +324,12 @@

    ${_("Account Navigation")}

      - % if settings.FEATURES.get('ENABLE_HELP_LINK'): + % if settings.ENABLE_HELP_LINK: % endif - % if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True): + % if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.ALLOW_PUBLIC_ACCOUNT_CREATION) and settings.SHOW_REGISTRATION_LINKS: diff --git a/cms/urls.py b/cms/urls.py index 048339bc9fe9..72a3b3a12ad4 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -230,7 +230,7 @@ path('openassessment/fileupload/', include('openassessment.fileupload.urls')), ] -if toggles.ENABLE_CONTENT_LIBRARIES: +if settings.ENABLE_CONTENT_LIBRARIES: urlpatterns += [ re_path(fr'^library/{LIBRARY_KEY_PATTERN}?$', contentstore_views.library_handler, name='library_handler'), @@ -245,12 +245,12 @@ name='export_git') ] -if settings.FEATURES.get('ENABLE_SERVICE_STATUS'): +if settings.ENABLE_SERVICE_STATUS: urlpatterns.append(path('status/', include('openedx.core.djangoapps.service_status.urls'))) # The password pages in the admin tool are disabled so that all password # changes go through our user portal and follow complexity requirements. -if not settings.FEATURES.get('ENABLE_CHANGE_USER_PASSWORD_ADMIN'): +if not settings.ENABLE_CHANGE_USER_PASSWORD_ADMIN: urlpatterns.append(re_path(r'^admin/auth/user/\d+/password/$', handler404)) urlpatterns.append(path('admin/password_change/', handler404)) urlpatterns.append( @@ -264,7 +264,7 @@ contentstore_views.entrance_exam)) # Enable Web/HTML Certificates -if settings.FEATURES.get('CERTIFICATES_HTML_VIEW'): +if settings.CERTIFICATES_HTML_VIEW: from cms.djangoapps.contentstore.views.certificates import ( CertificateActivationAPIView, CertificateDetailAPIView, diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index a739a9076fac..00f1f4faaae8 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -826,7 +826,7 @@ def is_eligible_for_certificate(cls, mode_slug, status=None): """ ineligible_modes = [cls.AUDIT] - if settings.FEATURES.get('DISABLE_HONOR_CERTIFICATES', False): + if settings.DISABLE_HONOR_CERTIFICATES: # Adding check so that we can regenerate the certificate for learners who have # already earned the certificate using honor mode from lms.djangoapps.certificates.data import CertificateStatuses diff --git a/common/djangoapps/course_modes/urls.py b/common/djangoapps/course_modes/urls.py index 8c3e562688d8..51f6fae7d805 100644 --- a/common/djangoapps/course_modes/urls.py +++ b/common/djangoapps/course_modes/urls.py @@ -11,7 +11,7 @@ ] # Enable verified mode creation -if settings.FEATURES.get('MODE_CREATION_FOR_TESTING'): +if settings.MODE_CREATION_FOR_TESTING: urlpatterns.append( re_path(fr'^create_mode/{settings.COURSE_ID_PATTERN}/$', views.create_mode, diff --git a/common/djangoapps/course_modes/views.py b/common/djangoapps/course_modes/views.py index 09164dc40e7c..2307ab13452f 100644 --- a/common/djangoapps/course_modes/views.py +++ b/common/djangoapps/course_modes/views.py @@ -381,7 +381,7 @@ def _redirect_to_course_or_dashboard(self, course, course_key, user): def create_mode(request, course_id): """Add a mode to the course corresponding to the given course ID. - Only available when settings.FEATURES['MODE_CREATION_FOR_TESTING'] is True. + Only available when settings.MODE_CREATION_FOR_TESTING is True. Attempts to use the following querystring parameters from the request: `mode_slug` (str): The mode to add, either 'honor', 'verified', or 'professional' diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index a8b0e7a0d9f5..43f3413777c2 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -45,7 +45,7 @@ def marketing_link(name): link_map = settings.MKTG_URL_LINK_MAP enable_mktg_site = configuration_helpers.get_value( 'ENABLE_MKTG_SITE', - settings.FEATURES.get('ENABLE_MKTG_SITE', False) + settings.ENABLE_MKTG_SITE ) marketing_urls = configuration_helpers.get_value( 'MKTG_URLS', @@ -115,7 +115,7 @@ def is_marketing_link_set(name): enable_mktg_site = configuration_helpers.get_value( 'ENABLE_MKTG_SITE', - settings.FEATURES.get('ENABLE_MKTG_SITE', False) + settings.ENABLE_MKTG_SITE ) marketing_urls = configuration_helpers.get_value( 'MKTG_URLS', diff --git a/common/djangoapps/student/admin.py b/common/djangoapps/student/admin.py index 151c6ab5b8ca..ac858df71417 100644 --- a/common/djangoapps/student/admin.py +++ b/common/djangoapps/student/admin.py @@ -538,7 +538,7 @@ class UserChangeForm(BaseUserChangeForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - if not settings.FEATURES.get('ENABLE_CHANGE_USER_PASSWORD_ADMIN'): + if not settings.ENABLE_CHANGE_USER_PASSWORD_ADMIN: self.fields["password"] = ReadOnlyPasswordHashField( label=_("Password"), help_text=_( diff --git a/common/djangoapps/student/auth.py b/common/djangoapps/student/auth.py index b9abbe1efaf2..62533f8911a3 100644 --- a/common/djangoapps/student/auth.py +++ b/common/djangoapps/student/auth.py @@ -61,10 +61,10 @@ def user_has_role(user, role): # CourseCreator is odd b/c it can be disabled via config if isinstance(role, CourseCreatorRole): # completely shut down course creation setting - if settings.FEATURES.get('DISABLE_COURSE_CREATION', False): + if settings.DISABLE_COURSE_CREATION: return False # wide open course creation setting - if not settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): + if not settings.ENABLE_CREATOR_GROUP: return True if role.has_user(user): @@ -163,7 +163,7 @@ def has_studio_advanced_settings_access(user): By default, this feature is disabled. """ return ( - not settings.FEATURES.get('DISABLE_ADVANCED_SETTINGS', False) + not settings.DISABLE_ADVANCED_SETTINGS or user.is_staff or user.is_superuser ) @@ -205,7 +205,7 @@ def check_course_advanced_settings_access(user, course_key, access_type='read'): # For feature_restricted access type, check DISABLE_ADVANCED_SETTINGS feature if ( access_type == 'feature_restricted' - and settings.FEATURES.get('DISABLE_ADVANCED_SETTINGS', False) + and settings.DISABLE_ADVANCED_SETTINGS ): # When feature is disabled, only staff/superuser can access (bypass authz) return user.is_staff or user.is_superuser diff --git a/common/djangoapps/student/email_helpers.py b/common/djangoapps/student/email_helpers.py index b92f922af63b..7105b77ef27c 100644 --- a/common/djangoapps/student/email_helpers.py +++ b/common/djangoapps/student/email_helpers.py @@ -57,7 +57,7 @@ def generate_proctoring_requirements_email_context(user, course_id): 'course_name': course_block.display_name, 'proctoring_provider': capwords(course_block.proctoring_provider.replace('_', ' ')), 'proctoring_requirements_url': settings.PROCTORING_SETTINGS.get('LINK_URLS', {}).get('faq', ''), - 'idv_required': not settings.FEATURES.get('ENABLE_INTEGRITY_SIGNATURE'), + 'idv_required': not settings.ENABLE_INTEGRITY_SIGNATURE, 'id_verification_url': IDVerificationService.get_verify_location(), } diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py index 834c230871da..59d452be1505 100644 --- a/common/djangoapps/student/helpers.py +++ b/common/djangoapps/student/helpers.py @@ -122,7 +122,7 @@ def check_verify_status_by_course(user, course_enrollments): status_by_course = {} # If integrity signature is enabled, this is a no-op because IDV is not required - if settings.FEATURES.get('ENABLE_INTEGRITY_SIGNATURE'): + if settings.ENABLE_INTEGRITY_SIGNATURE: return status_by_course # Retrieve all verifications for the user, sorted in descending @@ -316,7 +316,7 @@ def get_next_url_for_login_page(request, include_host=False): # Append a tpa_hint query parameter, if one is configured tpa_hint = configuration_helpers.get_value( "THIRD_PARTY_AUTH_HINT", - settings.FEATURES.get("THIRD_PARTY_AUTH_HINT", '') + settings.THIRD_PARTY_AUTH_HINT ) if tpa_hint: # Don't add tpa_hint if we're already in the TPA pipeline (prevent infinite loop), @@ -676,7 +676,7 @@ def do_create_account(form, custom_form=None): # Check if ALLOW_PUBLIC_ACCOUNT_CREATION flag turned off to restrict user account creation if not configuration_helpers.get_value( 'ALLOW_PUBLIC_ACCOUNT_CREATION', - settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION', True) + settings.ALLOW_PUBLIC_ACCOUNT_CREATION ): raise PermissionDenied() diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index 8a23f89a53b3..bbd673172d95 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -199,7 +199,7 @@ def is_small_course(self, course_id): 'course_id' is the course_id to return enrollments """ - max_enrollments = settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") + max_enrollments = settings.MAX_ENROLLMENT_INSTR_BUTTONS enrollment_number = super().get_queryset().filter( course_id=course_id, diff --git a/common/djangoapps/student/models/user.py b/common/djangoapps/student/models/user.py index a9055d52479c..fb5be113e269 100644 --- a/common/djangoapps/student/models/user.py +++ b/common/djangoapps/student/models/user.py @@ -971,7 +971,7 @@ def is_feature_enabled(cls): """ Returns whether the feature flag around this functionality has been set """ - return settings.FEATURES['ENABLE_MAX_FAILED_LOGIN_ATTEMPTS'] + return settings.ENABLE_MAX_FAILED_LOGIN_ATTEMPTS @classmethod def is_user_locked_out(cls, user): @@ -1249,7 +1249,7 @@ def add_user_to_default_group(user, group): # lint-amnesty, pylint: disable=mis def create_comments_service_user(user): # lint-amnesty, pylint: disable=missing-function-docstring - if not settings.FEATURES['ENABLE_DISCUSSION_SERVICE']: + if not settings.ENABLE_DISCUSSION_SERVICE: # Don't try--it won't work, and it will fill the logs with lots of errors return try: @@ -1278,7 +1278,7 @@ def log_successful_login(sender, request, user, **kwargs): # lint-amnesty, pyli 'event_type': "login", } ) - if settings.FEATURES['SQUELCH_PII_IN_LOGS']: + if settings.SQUELCH_PII_IN_LOGS: AUDIT_LOG.info(f"Login success - user.id: {user.id}") else: AUDIT_LOG.info(f"Login success - {user.username} ({user.email})") @@ -1295,7 +1295,7 @@ def log_successful_logout(sender, request, user, **kwargs): # lint-amnesty, pyl 'event_type': "logout", } ) - if settings.FEATURES['SQUELCH_PII_IN_LOGS']: + if settings.SQUELCH_PII_IN_LOGS: AUDIT_LOG.info(f'Logout - user.id: {request.user.id}') # pylint: disable=logging-format-interpolation else: AUDIT_LOG.info(f'Logout - {request.user}') # pylint: disable=logging-format-interpolation @@ -1310,7 +1310,7 @@ def enforce_single_login(sender, request, user, signal, **kwargs): # pylint: di Sets the current session id in the user profile, to prevent concurrent logins. """ - if settings.FEATURES.get('PREVENT_CONCURRENT_LOGINS', False): + if settings.PREVENT_CONCURRENT_LOGINS: if signal == user_logged_in: key = request.session.session_key else: diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index bcede1821376..81308210073f 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -530,7 +530,7 @@ def assertChangeEmailSent(self, test_body_type): assert len(mail.outbox) == 2 use_https = self.request.is_secure() - if settings.FEATURES['ENABLE_MKTG_SITE']: + if settings.ENABLE_MKTG_SITE: contact_link = marketing_link('CONTACT') else: contact_link = '{protocol}://{site}{link}'.format( diff --git a/common/djangoapps/student/tests/test_views.py b/common/djangoapps/student/tests/test_views.py index ed8c98188a50..12038967da6d 100644 --- a/common/djangoapps/student/tests/test_views.py +++ b/common/djangoapps/student/tests/test_views.py @@ -1009,7 +1009,7 @@ def test_happy_path_upgrade_message( @skip_unless_lms -@unittest.skipUnless(settings.FEATURES.get("ENABLE_NOTICES"), 'Notices plugin is not enabled') +@unittest.skipUnless(settings.ENABLE_NOTICES, 'Notices plugin is not enabled') class TestCourseDashboardNoticesRedirects(SharedModuleStoreTestCase): """ Tests for the Dashboard redirect functionality introduced via the Notices plugin. diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 03061dcb065b..1dca98e171fd 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -386,7 +386,7 @@ def credit_statuses(user, course_enrollments): from openedx.core.djangoapps.credit import api as credit_api # Feature flag off - if not settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY"): + if not settings.ENABLE_CREDIT_ELIGIBILITY: return {} request_status_by_course = { @@ -541,25 +541,25 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem enable_verified_certificates = configuration_helpers.get_value( 'ENABLE_VERIFIED_CERTIFICATES', - settings.FEATURES.get('ENABLE_VERIFIED_CERTIFICATES') + settings.ENABLE_VERIFIED_CERTIFICATES ) display_course_modes_on_dashboard = configuration_helpers.get_value( 'DISPLAY_COURSE_MODES_ON_DASHBOARD', - settings.FEATURES.get('DISPLAY_COURSE_MODES_ON_DASHBOARD', True) + settings.DISPLAY_COURSE_MODES_ON_DASHBOARD ) activation_email_support_link = configuration_helpers.get_value( 'ACTIVATION_EMAIL_SUPPORT_LINK', settings.ACTIVATION_EMAIL_SUPPORT_LINK ) or settings.SUPPORT_SITE_LINK hide_dashboard_courses_until_activated = configuration_helpers.get_value( 'HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED', - settings.FEATURES.get('HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED', False) + settings.HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED ) empty_dashboard_message = configuration_helpers.get_value( 'EMPTY_DASHBOARD_MESSAGE', None ) disable_unenrollment = configuration_helpers.get_value( 'DISABLE_UNENROLLMENT', - settings.FEATURES.get('DISABLE_UNENROLLMENT') + settings.DISABLE_UNENROLLMENT ) disable_course_limit = request and 'course_limit' in request.GET diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index 3af83742613d..e294b7771909 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -139,7 +139,7 @@ def index(request, extra_context=None, user=AnonymousUser()): if configuration_helpers.get_value( "ENABLE_COURSE_SORTING_BY_START_DATE", - settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"], + settings.ENABLE_COURSE_SORTING_BY_START_DATE, ): courses = sort_by_start_date(courses) else: @@ -220,7 +220,7 @@ def compose_activation_email( }) if route_enabled: - dest_addr = settings.FEATURES['REROUTE_ACTIVATION_EMAIL'] + dest_addr = settings.REROUTE_ACTIVATION_EMAIL else: dest_addr = user.email @@ -266,7 +266,7 @@ def compose_and_send_activation_email( redirect_url: The URL to redirect to after successful activation registration_flow: Is the request coming from registration workflow """ - route_enabled = settings.FEATURES.get('REROUTE_ACTIVATION_EMAIL') + route_enabled = bool(settings.REROUTE_ACTIVATION_EMAIL) msg = compose_activation_email( user, user_registration, route_enabled, profile.name, redirect_url, registration_flow @@ -395,7 +395,7 @@ def change_enrollment(request, check_access=True): return HttpResponseBadRequest(_("Course id is invalid")) # Record the user's email opt-in preference - if settings.FEATURES.get('ENABLE_MKTG_EMAIL_OPT_IN'): + if settings.ENABLE_MKTG_EMAIL_OPT_IN: _update_email_opt_in(request, course_id.org) available_modes = CourseMode.modes_for_course_dict(course_id) @@ -445,7 +445,7 @@ def change_enrollment(request, check_access=True): elif action == "unenroll": if configuration_helpers.get_value( "DISABLE_UNENROLLMENT", - settings.FEATURES.get("DISABLE_UNENROLLMENT") + settings.DISABLE_UNENROLLMENT ): return HttpResponseBadRequest(_("Unenrollment is currently disabled")) @@ -893,7 +893,7 @@ def confirm_email_change(request, key): return response use_https = request.is_secure() - if settings.FEATURES['ENABLE_MKTG_SITE']: + if settings.ENABLE_MKTG_SITE: contact_link = marketing_link('CONTACT') else: contact_link = '{protocol}://{site}{link}'.format( diff --git a/common/djangoapps/third_party_auth/__init__.py b/common/djangoapps/third_party_auth/__init__.py index 027c4648c460..8ae3323429a7 100644 --- a/common/djangoapps/third_party_auth/__init__.py +++ b/common/djangoapps/third_party_auth/__init__.py @@ -12,5 +12,5 @@ def is_enabled(): return configuration_helpers.get_value( "ENABLE_THIRD_PARTY_AUTH", - settings.FEATURES.get("ENABLE_THIRD_PARTY_AUTH") + settings.ENABLE_THIRD_PARTY_AUTH ) diff --git a/common/djangoapps/third_party_auth/apps.py b/common/djangoapps/third_party_auth/apps.py index 7f6b82cfde1f..5f47080990ea 100644 --- a/common/djangoapps/third_party_auth/apps.py +++ b/common/djangoapps/third_party_auth/apps.py @@ -13,7 +13,7 @@ def ready(self): from .signals import handlers # noqa: F401 pylint: disable=unused-import # To override the settings before loading social_django. - if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False): + if settings.ENABLE_THIRD_PARTY_AUTH: self._enable_third_party_auth() def _enable_third_party_auth(self): diff --git a/common/djangoapps/third_party_auth/decorators.py b/common/djangoapps/third_party_auth/decorators.py index 66540212e10e..8b29680be10c 100644 --- a/common/djangoapps/third_party_auth/decorators.py +++ b/common/djangoapps/third_party_auth/decorators.py @@ -21,7 +21,7 @@ def wrapped_view(request, *args, **kwargs): """ Modify the response with the correct X-Frame-Options. """ resp = view_func(request, *args, **kwargs) x_frame_option = settings.X_FRAME_OPTIONS - if settings.FEATURES['ENABLE_THIRD_PARTY_AUTH']: + if settings.ENABLE_THIRD_PARTY_AUTH: referer = request.META.get('HTTP_REFERER') if referer is not None: parsed_url = urlparse(referer) diff --git a/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py b/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py index 798816d4c190..acd6848aa9a6 100644 --- a/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py +++ b/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py @@ -38,7 +38,7 @@ def add_arguments(self, parser): def handle(self, *args, **options): slug = options['IDP'] - if not settings.FEATURES.get('ENABLE_ENROLLMENT_RESET'): + if not settings.ENABLE_ENROLLMENT_RESET: raise CommandError('ENABLE_ENROLLMENT_RESET feature not enabled on this enviroment') try: diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py index d3beafb4db88..0c7b8f55a575 100644 --- a/common/djangoapps/third_party_auth/models.py +++ b/common/djangoapps/third_party_auth/models.py @@ -70,7 +70,7 @@ def clean_username(username=''): """ Simple helper method to ensure a username is compatible with our system requirements. """ - if settings.FEATURES.get("ENABLE_UNICODE_USERNAME"): + if settings.ENABLE_UNICODE_USERNAME: return ('_').join(re.findall(settings.USERNAME_REGEX_PARTIAL, username))[:USERNAME_MAX_LENGTH] else: return ('_').join(re.findall(r'[a-zA-Z0-9\-]+', username))[:USERNAME_MAX_LENGTH] diff --git a/common/djangoapps/third_party_auth/settings.py b/common/djangoapps/third_party_auth/settings.py index 0aeb94fbd498..48a35a7da932 100644 --- a/common/djangoapps/third_party_auth/settings.py +++ b/common/djangoapps/third_party_auth/settings.py @@ -43,7 +43,7 @@ def apply_settings(django_settings): django_settings.SOCIAL_AUTH_AZUREAD_OAUTH2_AUTH_EXTRA_ARGUMENTS = {'msafed': 0} # Avoid default username check to allow non-ascii characters - django_settings.SOCIAL_AUTH_CLEAN_USERNAMES = not settings.FEATURES.get("ENABLE_UNICODE_USERNAME") + django_settings.SOCIAL_AUTH_CLEAN_USERNAMES = not settings.ENABLE_UNICODE_USERNAME # Inject our customized auth pipeline. All auth backends must work with # this pipeline. diff --git a/common/djangoapps/third_party_auth/tests/specs/base.py b/common/djangoapps/third_party_auth/tests/specs/base.py index 524cd64ff366..ef550aae1b97 100644 --- a/common/djangoapps/third_party_auth/tests/specs/base.py +++ b/common/djangoapps/third_party_auth/tests/specs/base.py @@ -150,7 +150,7 @@ def assert_register_form_populates_unicode_username_correctly( partial_unicode_username = unicode_username + ascii_substring pipeline_kwargs = pipeline.get(request)["kwargs"] - assert settings.FEATURES["ENABLE_UNICODE_USERNAME"] is False + assert settings.ENABLE_UNICODE_USERNAME is False self._check_registration_form_username(pipeline_kwargs, unicode_username, "") self._check_registration_form_username(pipeline_kwargs, partial_unicode_username, ascii_substring) @@ -576,9 +576,7 @@ def complete_url(self): return reverse("social:complete", kwargs={"backend": self.PROVIDER_BACKEND}) -@unittest.skipUnless( - testutil.AUTH_FEATURES_KEY in django_settings.FEATURES, testutil.AUTH_FEATURES_KEY + " not in settings.FEATURES" -) +@unittest.skipUnless(settings.ENABLE_THIRD_PARTY_AUTH, "Third party auth is disabled.") @django_utils.override_settings() # For settings reversion on a method-by-method basis. class IntegrationTest(testutil.TestCase, test.TestCase, HelperMixin): """Abstract base class for provider integration tests.""" diff --git a/common/djangoapps/third_party_auth/tests/test_views.py b/common/djangoapps/third_party_auth/tests/test_views.py index 859967ffa05f..79893bab51f6 100644 --- a/common/djangoapps/third_party_auth/tests/test_views.py +++ b/common/djangoapps/third_party_auth/tests/test_views.py @@ -22,12 +22,12 @@ from common.djangoapps.third_party_auth.utils import SAML_XML_NS from common.djangoapps.third_party_auth.views import inactive_user_view -from .testutil import AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY, SAMLTestCase +from .testutil import SAMLTestCase XMLDSIG_XML_NS = 'http://www.w3.org/2000/09/xmldsig#' -@unittest.skipUnless(AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY + ' not enabled') +@unittest.skipUnless(settings.ENABLE_THIRD_PARTY_AUTH, "Third party auth is disabled.") @ddt.ddt class SAMLMetadataTest(SAMLTestCase): """ @@ -145,7 +145,7 @@ def check_metadata_contacts(self, xml, tech_name, tech_email, support_name, supp assert support_email_node.text == support_email -@unittest.skipUnless(AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY + ' not enabled') +@unittest.skipUnless(settings.ENABLE_THIRD_PARTY_AUTH, "Third party auth is disabled.") class SAMLAuthTest(SAMLTestCase): """ Test the SAML auth views @@ -165,7 +165,7 @@ def test_login_disabled(self): assert response.status_code == 404 -@unittest.skipUnless(AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY + ' not enabled') +@unittest.skipUnless(settings.ENABLE_THIRD_PARTY_AUTH, "Third party auth is disabled.") class IdPRedirectViewTest(SAMLTestCase): """ Test IdPRedirectView. @@ -205,7 +205,7 @@ def get_idp_redirect_url(provider_slug, next_destination=None): ) -@unittest.skipUnless(AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY + ' not enabled') +@unittest.skipUnless(settings.ENABLE_THIRD_PARTY_AUTH, "Third party auth is disabled.") class InactiveUserViewTests(TestCase): """Test inactive user view """ @patch('common.djangoapps.third_party_auth.views.redirect') diff --git a/common/djangoapps/third_party_auth/tests/testutil.py b/common/djangoapps/third_party_auth/tests/testutil.py index 33eb30009b41..80d5f79b5585 100644 --- a/common/djangoapps/third_party_auth/tests/testutil.py +++ b/common/djangoapps/third_party_auth/tests/testutil.py @@ -26,9 +26,6 @@ from openedx.core.djangolib.testing.utils import CacheIsolationMixin from openedx.core.storage import OverwriteStorage -AUTH_FEATURES_KEY = 'ENABLE_THIRD_PARTY_AUTH' -AUTH_FEATURE_ENABLED = AUTH_FEATURES_KEY in settings.FEATURES - def patch_mako_templates(): """ Patch mako so the django test client can access template context """ diff --git a/common/djangoapps/third_party_auth/tests/utils.py b/common/djangoapps/third_party_auth/tests/utils.py index 8d1bafcdd887..f2de133e7834 100644 --- a/common/djangoapps/third_party_auth/tests/utils.py +++ b/common/djangoapps/third_party_auth/tests/utils.py @@ -6,6 +6,7 @@ from unittest import skip import httpretty +from django.conf import settings from onelogin.saml2.utils import OneLogin_Saml2_Utils from oauth2_provider.models import Application from social_core.backends.facebook import API_VERSION as FACEBOOK_API_VERSION @@ -14,7 +15,7 @@ from common.djangoapps.student.tests.factories import UserFactory -from .testutil import ThirdPartyAuthTestMixin, AUTH_FEATURE_ENABLED, AUTH_FEATURES_KEY +from .testutil import ThirdPartyAuthTestMixin @httpretty.activate @@ -150,6 +151,6 @@ def skip_unless_thirdpartyauth(): """ Wraps unittest.skip in consistent logic to skip certain third_party_auth tests in CMS. """ - if AUTH_FEATURE_ENABLED: + if settings.ENABLE_THIRD_PARTY_AUTH: return lambda func: func - return skip("%s not enabled" % AUTH_FEATURES_KEY) + return skip("%s not enabled" % "ENABLE_THIRD_PARTY_AUTH") diff --git a/common/djangoapps/util/course.py b/common/djangoapps/util/course.py index abef18a3263d..c98959fd02ec 100644 --- a/common/djangoapps/util/course.py +++ b/common/djangoapps/util/course.py @@ -59,7 +59,7 @@ def get_link_for_about_page(course): if is_social_sharing_enabled and course.social_sharing_url: course_about_url = course.social_sharing_url - elif settings.FEATURES.get('ENABLE_MKTG_SITE') and getattr(course, 'marketing_url', None): + elif settings.ENABLE_MKTG_SITE and getattr(course, 'marketing_url', None): course_about_url = course.marketing_url else: course_about_url = f'{about_base_url}/courses/{course.id}/about' @@ -80,7 +80,7 @@ def has_certificates_enabled(course): course: This can be either a course overview object or a course block. Returns a boolean if the course has enabled certificates """ - if not settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False): + if not settings.CERTIFICATES_HTML_VIEW: return False return course.cert_html_view_enabled diff --git a/common/djangoapps/util/milestones_helpers.py b/common/djangoapps/util/milestones_helpers.py index 94ec358f9286..1b7e786d2c04 100644 --- a/common/djangoapps/util/milestones_helpers.py +++ b/common/djangoapps/util/milestones_helpers.py @@ -45,7 +45,7 @@ def is_prerequisite_courses_enabled(): """ Returns boolean indicating prerequisite courses enabled system wide or not. """ - return settings.FEATURES.get('ENABLE_PREREQUISITE_COURSES') and ENABLE_MILESTONES_APP.is_enabled() + return settings.ENABLE_PREREQUISITE_COURSES and ENABLE_MILESTONES_APP.is_enabled() def add_prerequisite_course(course_key, prerequisite_course_key): diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py index 52aeb9b3e1b8..77b8099b713b 100644 --- a/lms/djangoapps/branding/api.py +++ b/lms/djangoapps/branding/api.py @@ -431,7 +431,7 @@ def _footer_mobile_links(is_secure): platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME) mobile_links = [] - if settings.FEATURES.get('ENABLE_FOOTER_MOBILE_APP_LINKS'): + if settings.ENABLE_FOOTER_MOBILE_APP_LINKS: mobile_links = [ { "name": "apple", diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py index 33c5813f16ff..1cd824081196 100644 --- a/lms/djangoapps/branding/views.py +++ b/lms/djangoapps/branding/views.py @@ -98,13 +98,13 @@ def courses(request): enable_mktg_site = configuration_helpers.get_value( 'ENABLE_MKTG_SITE', - settings.FEATURES.get('ENABLE_MKTG_SITE', False) + settings.ENABLE_MKTG_SITE ) if enable_mktg_site: return redirect(marketing_link('COURSES'), permanent=True) - if not settings.FEATURES.get('COURSES_ARE_BROWSABLE'): + if not settings.COURSES_ARE_BROWSABLE: raise Http404 # we do not expect this case to be reached in cases where diff --git a/lms/djangoapps/ccx/plugins.py b/lms/djangoapps/ccx/plugins.py index 1852f5727a28..2555ac74f2f2 100644 --- a/lms/djangoapps/ccx/plugins.py +++ b/lms/djangoapps/ccx/plugins.py @@ -28,7 +28,7 @@ def is_enabled(cls, course, user=None): """ Returns true if CCX has been enabled and the specified user is a coach """ - if not settings.FEATURES.get('CUSTOM_COURSES_EDX', False) or not course.enable_ccx: + if not settings.CUSTOM_COURSES_EDX or not course.enable_ccx: # If ccx is not enable do not show ccx coach tab. return False diff --git a/lms/djangoapps/certificates/apps.py b/lms/djangoapps/certificates/apps.py index 50e5442c28be..8b510881187f 100644 --- a/lms/djangoapps/certificates/apps.py +++ b/lms/djangoapps/certificates/apps.py @@ -23,6 +23,6 @@ def ready(self): # Can't import models at module level in AppConfigs, and models get # included from the signal handlers from lms.djangoapps.certificates import signals # pylint: disable=unused-import - if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'): + if settings.ENABLE_SPECIAL_EXAMS: from lms.djangoapps.certificates.services import CertificateService set_runtime_service('certificates', CertificateService()) diff --git a/lms/djangoapps/certificates/utils.py b/lms/djangoapps/certificates/utils.py index 7ff2a4c97b27..b75d54b1879f 100644 --- a/lms/djangoapps/certificates/utils.py +++ b/lms/djangoapps/certificates/utils.py @@ -87,7 +87,7 @@ def has_html_certificates_enabled(course_overview): """ Returns True if HTML certificates are enabled in a course run. """ - if not settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False): + if not settings.CERTIFICATES_HTML_VIEW: return False return course_overview.cert_html_view_enabled diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index bee1638342fb..7d11bc6f67bd 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -82,7 +82,7 @@ def get_certificate_description(mode, certificate_type, platform_name, course_ke "{platform_name} and has completed all of the required tasks for this course " "under its guidelines. ").format(cert_type=certificate_type, platform_name=platform_name) - if settings.FEATURES.get('ENABLE_CERTIFICATES_IDV_REQUIREMENT'): + if settings.ENABLE_CERTIFICATES_IDV_REQUIREMENT: certificate_type_description += _("A {cert_type} certificate also indicates that the " "identity of the learner has been checked and " "is valid.").format(cert_type=certificate_type) @@ -250,7 +250,7 @@ def _update_course_context(request, context, course, platform_name): context['accomplishment_copy_course_name'] = accomplishment_copy_course_name course_number = course.display_coursenumber if course.display_coursenumber else course.number context['course_number'] = course_number - context['idv_enabled_for_certificates'] = settings.FEATURES.get('ENABLE_CERTIFICATES_IDV_REQUIREMENT') + context['idv_enabled_for_certificates'] = settings.ENABLE_CERTIFICATES_IDV_REQUIREMENT if context['organization_long_name']: # Translators: This text represents the description of course context['accomplishment_copy_course_description'] = _('a course of study offered by {partner_short_name}, ' @@ -476,7 +476,7 @@ def render_html_view(request, course_id, certificate=None): # pylint: disable=t configuration = CertificateHtmlViewConfiguration.get_config() # Kick the user back to the "Invalid" screen if the feature is disabled globally - if not settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False): + if not settings.CERTIFICATES_HTML_VIEW: return _render_invalid_certificate(request, course_id, platform_name, configuration) # Load the course and user objects @@ -532,7 +532,7 @@ def render_html_view(request, course_id, certificate=None): # pylint: disable=t # Determine whether to use the standard or custom template to render the certificate. custom_template = None custom_template_language = None - if settings.FEATURES.get('CUSTOM_CERTIFICATE_TEMPLATES_ENABLED', False): + if settings.CUSTOM_CERTIFICATE_TEMPLATES_ENABLED: log.info("Custom certificate for course %s", course_id) custom_template, custom_template_language = _get_custom_template_and_language( course.id, diff --git a/lms/djangoapps/course_api/api.py b/lms/djangoapps/course_api/api.py index 8210396441c7..a7af7b169886 100644 --- a/lms/djangoapps/course_api/api.py +++ b/lms/djangoapps/course_api/api.py @@ -86,7 +86,7 @@ def _filter_by_search(course_queryset, search_term, mobile_search=False): """ Filters a course queryset by the specified search term. """ - if not settings.FEATURES['ENABLE_COURSEWARE_SEARCH'] or not search_term: + if not settings.ENABLE_COURSEWARE_SEARCH or not search_term: return course_queryset # Return all the results, 10K is the maximum allowed value for ElasticSearch. diff --git a/lms/djangoapps/course_api/blocks/serializers.py b/lms/djangoapps/course_api/blocks/serializers.py index acf77c3076ef..d26dbe20cf91 100644 --- a/lms/djangoapps/course_api/blocks/serializers.py +++ b/lms/djangoapps/course_api/blocks/serializers.py @@ -174,7 +174,7 @@ def to_representation(self, block_key): # lint-amnesty, pylint: disable=argumen ), } - if settings.FEATURES.get("ENABLE_LTI_PROVIDER") and 'lti_url' in self.context['requested_fields']: + if settings.ENABLE_LTI_PROVIDER and 'lti_url' in self.context['requested_fields']: data['lti_url'] = reverse( 'lti_provider_launch', kwargs={'course_id': str(block_key.course_key), 'usage_id': str(block_key)}, diff --git a/lms/djangoapps/course_api/blocks/transformers/milestones.py b/lms/djangoapps/course_api/blocks/transformers/milestones.py index bddaa10f50b7..b5ff5304756b 100644 --- a/lms/djangoapps/course_api/blocks/transformers/milestones.py +++ b/lms/djangoapps/course_api/blocks/transformers/milestones.py @@ -73,7 +73,7 @@ def user_gated_from_block(block_key): return True elif not self.include_gated_sections and self.has_pending_milestones_for_user(block_key, usage_info): return True - elif (settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and + elif (settings.ENABLE_SPECIAL_EXAMS and (self.is_special_exam(block_key, block_structure) and not self.include_special_exams)): return True diff --git a/lms/djangoapps/course_wiki/middleware.py b/lms/djangoapps/course_wiki/middleware.py index 37bef0b74740..a46fd880a202 100644 --- a/lms/djangoapps/course_wiki/middleware.py +++ b/lms/djangoapps/course_wiki/middleware.py @@ -108,7 +108,7 @@ def process_view(self, request, view_func, view_args, view_kwargs): # lint-amne # Check to see if we don't allow top-level access to the wiki via the /wiki/xxxx/yyy/zzz URLs # this will help prevent people from writing pell-mell to the Wiki in an unstructured way - if not settings.FEATURES.get('ALLOW_WIKI_ROOT_ACCESS', False): + if not settings.ALLOW_WIKI_ROOT_ACCESS: raise PermissionDenied() return self._redirect_from_referrer(request, wiki_path) diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index a1a46137fcca..8d0065ec61a2 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -282,7 +282,7 @@ def _can_enroll_courselike(user, courselike): # DISABLE_ALLOWED_ENROLLMENT_IF_ENROLLMENT_CLOSED flag is used to disable enrollment for user invited # to a course if user is registering when the course enrollment is closed if ( - settings.FEATURES.get('DISABLE_ALLOWED_ENROLLMENT_IF_ENROLLMENT_CLOSED') and + settings.DISABLE_ALLOWED_ENROLLMENT_IF_ENROLLMENT_CLOSED and not course_enrollment_open and not user_has_staff_access ): diff --git a/lms/djangoapps/courseware/access_utils.py b/lms/djangoapps/courseware/access_utils.py index 4a9ec90e4a00..4cd24ce9c34d 100644 --- a/lms/djangoapps/courseware/access_utils.py +++ b/lms/djangoapps/courseware/access_utils.py @@ -135,7 +135,7 @@ def check_start_date(user, days_early_for_beta, start, course_key, display_error Returns: AccessResponse: Either ACCESS_GRANTED or StartDateError. """ - start_dates_disabled = settings.FEATURES["DISABLE_START_DATES"] + start_dates_disabled = settings.DISABLE_START_DATES masquerading_as_student = is_masquerading_as_student(user, course_key) if start_dates_disabled and not masquerading_as_student: diff --git a/lms/djangoapps/courseware/block_render.py b/lms/djangoapps/courseware/block_render.py index 00828c31c767..dc61ff71e87f 100644 --- a/lms/djangoapps/courseware/block_render.py +++ b/lms/djangoapps/courseware/block_render.py @@ -259,7 +259,7 @@ def _add_timed_exam_info(user, course, section, section_context): """ section_is_time_limited = ( getattr(section, 'is_time_limited', False) and - settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) + settings.ENABLE_SPECIAL_EXAMS ) if section_is_time_limited: # call into edx_proctoring subsystem @@ -555,7 +555,7 @@ def inner_get_block(block: XBlock) -> XBlock | None: block_wrappers.append(filter_displayed_blocks) mako_service = MakoService() - if settings.FEATURES.get("LICENSING", False): + if settings.LICENSING: block_wrappers.append(partial(wrap_with_license, mako_service=mako_service)) # Wrap the output display in a single div to allow for the XBlock @@ -584,7 +584,7 @@ def inner_get_block(block: XBlock) -> XBlock | None: user_is_staff = bool(has_access(user, 'staff', course_id)) - if settings.FEATURES.get('DISPLAY_DEBUG_INFO_TO_STAFF'): + if settings.DISPLAY_DEBUG_INFO_TO_STAFF: if user_is_staff or is_masquerading_as_specific_student(user, course_id): # When masquerading as a specific student, we want to show the debug button # unconditionally to enable resetting the state of the student we are masquerading as. @@ -1004,7 +1004,7 @@ def xblock_view(request, course_id, usage_id, view_name): resources: A list of tuples where the first element is the resource hash, and the second is the resource description """ - if not settings.FEATURES.get('ENABLE_XBLOCK_VIEW_ENDPOINT', False): + if not settings.ENABLE_XBLOCK_VIEW_ENDPOINT: log.warning("Attempt to use deactivated XBlock view endpoint -" " see FEATURES['ENABLE_XBLOCK_VIEW_ENDPOINT']") raise Http404 diff --git a/lms/djangoapps/courseware/date_summary.py b/lms/djangoapps/courseware/date_summary.py index e6bd5ef70597..6fb190b310cd 100644 --- a/lms/djangoapps/courseware/date_summary.py +++ b/lms/djangoapps/courseware/date_summary.py @@ -592,7 +592,7 @@ def is_allowed(self): is_active and mode == 'verified' and self.verification_status in ('expired', 'none', 'must_reverify') and - not settings.FEATURES.get('ENABLE_INTEGRITY_SIGNATURE') + not settings.ENABLE_INTEGRITY_SIGNATURE ) @lazy diff --git a/lms/djangoapps/courseware/masquerade.py b/lms/djangoapps/courseware/masquerade.py index 5ce266c463d6..4591523b1bf1 100644 --- a/lms/djangoapps/courseware/masquerade.py +++ b/lms/djangoapps/courseware/masquerade.py @@ -214,7 +214,7 @@ def setup_masquerade(request, course_key, staff_access=False, reset_masquerade_d """ if ( request.user is None or - not settings.FEATURES.get('ENABLE_MASQUERADE', False) or + not settings.ENABLE_MASQUERADE or not staff_access ): return None, request.user diff --git a/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py b/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py index 55e3d845b6a8..39711d387d8f 100644 --- a/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py +++ b/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py @@ -20,7 +20,7 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state): to_model = to_state.apps.get_model(app_label, self.model_name) if schema_editor.connection.alias == 'student_module_history': - if settings.FEATURES["ENABLE_CSMH_EXTENDED"]: + if settings.ENABLE_CSMH_EXTENDED: if schema_editor.connection.vendor == 'mysql': schema_editor.execute("ALTER TABLE `coursewarehistoryextended_studentmodulehistoryextended` MODIFY `student_module_id` bigint UNSIGNED NOT NULL;") elif schema_editor.connection.vendor == 'postgresql': @@ -44,7 +44,7 @@ class Migration(migrations.Migration): ('courseware', '0010_auto_20190709_1559'), ] - if settings.FEATURES["ENABLE_CSMH_EXTENDED"]: + if settings.ENABLE_CSMH_EXTENDED: dependencies.append(('coursewarehistoryextended', '0002_force_studentmodule_index')) operations = [ diff --git a/lms/djangoapps/courseware/models.py b/lms/djangoapps/courseware/models.py index 500629945141..2fb422ea1726 100644 --- a/lms/djangoapps/courseware/models.py +++ b/lms/djangoapps/courseware/models.py @@ -216,7 +216,7 @@ def get_history(student_modules): history_entries = [] - if settings.FEATURES.get('ENABLE_CSMH_EXTENDED'): + if settings.ENABLE_CSMH_EXTENDED: from lms.djangoapps.coursewarehistoryextended.models import StudentModuleHistoryExtended history_entries += StudentModuleHistoryExtended.objects.filter( # Django will sometimes try to join to courseware_studentmodule @@ -226,7 +226,7 @@ def get_history(student_modules): # If we turn off reading from multiple history tables, then we don't want to read from # StudentModuleHistory anymore, we believe that all history is in the Extended table. - if settings.FEATURES.get('ENABLE_READING_FROM_MULTIPLE_HISTORY_TABLES'): + if settings.ENABLE_READING_FROM_MULTIPLE_HISTORY_TABLES: # we want to save later SQL queries on the model which allows us to prefetch history_entries += StudentModuleHistory.objects.prefetch_related('student_module').filter( student_module__in=student_modules @@ -315,7 +315,7 @@ def save_history(sender, instance, **kwargs): # pylint: disable=no-self-argumen # When the extended studentmodulehistory table exists, don't save # duplicate history into courseware_studentmodulehistory, just retain # data for reading. - if not settings.FEATURES.get('ENABLE_CSMH_EXTENDED'): + if not settings.ENABLE_CSMH_EXTENDED: post_save.connect(save_history, sender=StudentModule) diff --git a/lms/djangoapps/courseware/plugins.py b/lms/djangoapps/courseware/plugins.py index f890512d2a48..2495b318f684 100644 --- a/lms/djangoapps/courseware/plugins.py +++ b/lms/djangoapps/courseware/plugins.py @@ -17,7 +17,7 @@ User = get_user_model() -TEXTBOOK_ENABLED = settings.FEATURES.get("ENABLE_TEXTBOOK", False) +TEXTBOOK_ENABLED = settings.ENABLE_TEXTBOOK class ProgressCourseApp(CourseApp): @@ -237,7 +237,7 @@ def is_available(cls, course_key: CourseKey) -> bool: """ Returns true if the proctoring app is available for all courses. """ - return settings.FEATURES.get('ENABLE_PROCTORED_EXAMS') + return settings.ENABLE_PROCTORED_EXAMS @classmethod def is_enabled(cls, course_key: CourseKey) -> bool: diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 56c1ca2e0e44..9f3691edc0fd 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -134,7 +134,7 @@ class TextbookTabs(TextbookTabsBase): @classmethod def is_enabled(cls, course, user=None): parent_is_enabled = super().is_enabled(course, user) - return settings.FEATURES.get('ENABLE_TEXTBOOK') and parent_is_enabled + return settings.ENABLE_TEXTBOOK and parent_is_enabled @classmethod def items(cls, course): diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index f4d2847cff0f..afca1893c8be 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -365,7 +365,7 @@ def setUp(self): 'autoAdvance': False, 'saveStateEnabled': True, 'saveStateUrl': '', - 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), + 'autoplay': settings.AUTOPLAY_VIDEOS, 'streams': '1.00:3_yD_cEKoCk', 'sources': '[]', 'duration': 111.0, diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 590a5f5acef4..c4ee2b1d8746 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -310,14 +310,14 @@ def courses(request): courses_list = [] course_discovery_meanings = getattr(settings, 'COURSE_DISCOVERY_MEANINGS', {}) set_default_filter = ENABLE_COURSE_DISCOVERY_DEFAULT_LANGUAGE_FILTER.is_enabled() - if not settings.FEATURES.get('ENABLE_COURSE_DISCOVERY'): + if not settings.ENABLE_COURSE_DISCOVERY: courses_list = get_courses( request.user, filter_={"catalog_visibility": CATALOG_VISIBILITY_CATALOG_AND_ABOUT}, ) if configuration_helpers.get_value("ENABLE_COURSE_SORTING_BY_START_DATE", - settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"]): + settings.ENABLE_COURSE_SORTING_BY_START_DATE): courses_list = sort_by_start_date(courses_list) else: courses_list = sort_by_announcement(courses_list) @@ -557,7 +557,7 @@ def url_to_enroll(course_key): Returns the URL to use to enroll in the specified course. """ url_to_enroll = reverse('about_course', args=[str(course_key)]) - if settings.FEATURES.get('ENABLE_MKTG_SITE'): + if settings.ENABLE_MKTG_SITE: url_to_enroll = marketing_link('COURSES') return url_to_enroll @@ -840,7 +840,7 @@ def course_about(request, course_id): # pylint: disable=too-many-statements show_courseware_link = bool( ( request.user.has_perm(VIEW_COURSEWARE, course) - ) or settings.FEATURES.get('ENABLE_LMS_MIGRATION') + ) or settings.ENABLE_LMS_MIGRATION ) # If the ecommerce checkout flow is enabled and the mode of the course is @@ -899,7 +899,7 @@ def course_about(request, course_id): # pylint: disable=too-many-statements 'studio_url': studio_url, 'registered': registered, 'course_target': course_target, - 'is_cosmetic_price_enabled': settings.FEATURES.get('ENABLE_COSMETIC_DISPLAY_PRICE'), + 'is_cosmetic_price_enabled': settings.ENABLE_COSMETIC_DISPLAY_PRICE, 'course_price': course_price, 'ecommerce_checkout': ecommerce_checkout, 'ecommerce_checkout_link': ecommerce_checkout_link, @@ -1098,7 +1098,7 @@ def _downloadable_certificate_message(course, cert_downloadable_status): # lint def _missing_required_verification(student, enrollment_mode): - return settings.FEATURES.get('ENABLE_CERTIFICATES_IDV_REQUIREMENT') and ( + return settings.ENABLE_CERTIFICATES_IDV_REQUIREMENT and ( enrollment_mode in CourseMode.VERIFIED_MODES and not IDVerificationService.user_is_verified(student) ) @@ -1171,7 +1171,7 @@ def credit_course_requirements(course_key, student): # If credit eligibility is not enabled or this is not a credit course, # short-circuit and return `None`. This indicates that credit requirements # should NOT be displayed on the progress page. - if not (settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY", False) and is_credit_course(course_key)): + if not (settings.ENABLE_CREDIT_ELIGIBILITY and is_credit_course(course_key)): return None # This indicates that credit requirements should NOT be displayed on the progress page. @@ -1226,9 +1226,9 @@ def _course_home_redirect_enabled(): Returns: boolean True or False """ if configuration_helpers.get_value( - 'ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False) + 'ENABLE_MKTG_SITE', settings.ENABLE_MKTG_SITE ) and configuration_helpers.get_value( - 'ENABLE_COURSE_HOME_REDIRECT', settings.FEATURES.get('ENABLE_COURSE_HOME_REDIRECT', True) + 'ENABLE_COURSE_HOME_REDIRECT', settings.ENABLE_COURSE_HOME_REDIRECT ): return True @@ -1713,7 +1713,7 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True, disable_sta 'enable_completion_on_view_service': enable_completion_on_view_service, 'edx_notes_enabled': is_feature_enabled(course, request.user), 'staff_access': staff_access, - 'xqa_server': settings.FEATURES.get('XQA_SERVER', 'http://your_xqa_server.com'), + 'xqa_server': settings.XQA_SERVER, 'missed_deadlines': missed_deadlines, 'missed_gated_content': missed_gated_content, 'has_ended': course.has_ended(), @@ -2360,7 +2360,7 @@ def courseware_mfe_search_enabled(request, course_id=None): user = request.user has_required_enrollment = False - if settings.FEATURES.get('ENABLE_COURSEWARE_SEARCH_VERIFIED_ENROLLMENT_REQUIRED'): + if settings.ENABLE_COURSEWARE_SEARCH_VERIFIED_ENROLLMENT_REQUIRED: enrollment_mode, _ = CourseEnrollment.enrollment_mode_for_user(user, course_key) if ( auth.user_has_role(user, CourseStaffRole(CourseKey.from_string(course_id))) @@ -2370,7 +2370,7 @@ def courseware_mfe_search_enabled(request, course_id=None): else: has_required_enrollment = True - inclusion_date = settings.FEATURES.get('COURSEWARE_SEARCH_INCLUSION_DATE') + inclusion_date = settings.COURSEWARE_SEARCH_INCLUSION_DATE start_date = CourseOverview.get_from_id(course_key).start has_valid_inclusion_date = False diff --git a/lms/djangoapps/coursewarehistoryextended/tests.py b/lms/djangoapps/coursewarehistoryextended/tests.py index a97adb96f485..defd4dc52bb5 100644 --- a/lms/djangoapps/coursewarehistoryextended/tests.py +++ b/lms/djangoapps/coursewarehistoryextended/tests.py @@ -20,7 +20,7 @@ from lms.djangoapps.courseware.tests.factories import StudentModuleFactory -@skipUnless(settings.FEATURES["ENABLE_CSMH_EXTENDED"], "CSMH Extended needs to be enabled") +@skipUnless(settings.ENABLE_CSMH_EXTENDED, "CSMH Extended needs to be enabled") class TestStudentModuleHistoryBackends(TestCase): """ Tests of data in CSMH and CSMHE """ # Tell Django to clean out all databases, not just default diff --git a/lms/djangoapps/discussion/config/settings.py b/lms/djangoapps/discussion/config/settings.py index e9dbfebeeadf..5b739d74f974 100644 --- a/lms/djangoapps/discussion/config/settings.py +++ b/lms/djangoapps/discussion/config/settings.py @@ -7,20 +7,10 @@ WAFFLE_NAMESPACE = 'discussion' -# .. toggle_name: FEATURES['ENABLE_FORUM_DAILY_DIGEST'] -# .. toggle_implementation: DjangoSetting -# .. toggle_default: False -# .. toggle_description: Settings for forums/discussions to on/off daily digest -# feature. Set this to True if you want to enable users to subscribe and unsubscribe -# for daily digest. This setting enables deprecation of daily digest. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2020-03-09 -ENABLE_FORUM_DAILY_DIGEST = 'enable_forum_daily_digest' - def is_forum_daily_digest_enabled(): """Returns whether forum notification features should be visible""" - return settings.FEATURES.get('ENABLE_FORUM_DAILY_DIGEST', False) + return settings.ENABLE_FORUM_DAILY_DIGEST # .. toggle_name: discussion.enable_captcha # .. toggle_implementation: CourseWaffleFlag diff --git a/lms/djangoapps/discussion/django_comment_client/utils.py b/lms/djangoapps/discussion/django_comment_client/utils.py index a0bb6b769183..285f6b842ca7 100644 --- a/lms/djangoapps/discussion/django_comment_client/utils.py +++ b/lms/djangoapps/discussion/django_comment_client/utils.py @@ -1018,7 +1018,7 @@ def is_discussion_enabled(course_id): """ Return True if discussions are enabled; else False """ - return settings.FEATURES.get('ENABLE_DISCUSSION_SERVICE') + return settings.ENABLE_DISCUSSION_SERVICE def is_content_authored_by(content, user): diff --git a/lms/djangoapps/discussion/plugins.py b/lms/djangoapps/discussion/plugins.py index e7edbf6f4a53..b3e66d130c7c 100644 --- a/lms/djangoapps/discussion/plugins.py +++ b/lms/djangoapps/discussion/plugins.py @@ -28,7 +28,7 @@ class DiscussionTab(TabFragmentViewMixin, EnrolledTab): priority = 40 view_name = 'forum_form_discussion' fragment_view_name = 'lms.djangoapps.discussion.views.DiscussionBoardFragmentView' - is_hideable = settings.FEATURES.get('ALLOW_HIDING_DISCUSSION_TAB', False) + is_hideable = settings.ALLOW_HIDING_DISCUSSION_TAB is_default = False body_class = 'discussion' online_help_token = 'discussions' diff --git a/lms/djangoapps/edxnotes/decorators.py b/lms/djangoapps/edxnotes/decorators.py index 7c12275aca92..6abb51aeefb1 100644 --- a/lms/djangoapps/edxnotes/decorators.py +++ b/lms/djangoapps/edxnotes/decorators.py @@ -26,7 +26,7 @@ def get_html(self, *args, **kwargs): generate_uid, get_edxnotes_id_token, get_public_endpoint, get_token_url, is_feature_enabled ) - if not settings.FEATURES.get("ENABLE_EDXNOTES"): + if not settings.ENABLE_EDXNOTES: return original_get_html(self, *args, **kwargs) runtime = getattr(self, 'block', self).runtime diff --git a/lms/djangoapps/edxnotes/plugins.py b/lms/djangoapps/edxnotes/plugins.py index 3964ed81dbd9..5f41135de50c 100644 --- a/lms/djangoapps/edxnotes/plugins.py +++ b/lms/djangoapps/edxnotes/plugins.py @@ -39,7 +39,7 @@ def is_enabled(cls, course, user=None): if not super().is_enabled(course, user=user): return False - if not settings.FEATURES.get("ENABLE_EDXNOTES"): + if not settings.ENABLE_EDXNOTES: return False if user and not user.is_authenticated: @@ -65,7 +65,7 @@ def is_available(cls, course_key: CourseKey) -> bool: # pylint: disable=unused- """ EdX notes availability is currently globally controlled via a feature setting. """ - return settings.FEATURES.get("ENABLE_EDXNOTES", False) + return settings.ENABLE_EDXNOTES @classmethod def is_enabled(cls, course_key: CourseKey) -> bool: # pylint: disable=unused-argument diff --git a/lms/djangoapps/edxnotes/tests.py b/lms/djangoapps/edxnotes/tests.py index 46920e927ad9..e0e7b0084e93 100644 --- a/lms/djangoapps/edxnotes/tests.py +++ b/lms/djangoapps/edxnotes/tests.py @@ -93,7 +93,7 @@ def get_html(self): return "original_get_html" -@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.") +@skipUnless(settings.ENABLE_EDXNOTES, "EdxNotes feature needs to be enabled.") class EdxNotesDecoratorTest(ModuleStoreTestCase): """ Tests for edxnotes decorator. @@ -190,7 +190,7 @@ def test_anonymous_user(self): assert problem.get_html() == "original_get_html" -@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.") +@skipUnless(settings.ENABLE_EDXNOTES, "EdxNotes feature needs to be enabled.") @ddt.ddt class EdxNotesHelpersTest(ModuleStoreTestCase): """ @@ -939,7 +939,7 @@ def verify_url(constructed, expected): verify_url(previous_url, previous_api_url) -@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.") +@skipUnless(settings.ENABLE_EDXNOTES, "EdxNotes feature needs to be enabled.") @ddt.ddt class EdxNotesViewsTest(ModuleStoreTestCase): """ @@ -1251,7 +1251,7 @@ def test_retire_user_downstream_unavailable(self, mock_delete_all_notes_for_user assert response.status_code == 500 -@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.") +@skipUnless(settings.ENABLE_EDXNOTES, "EdxNotes feature needs to be enabled.") @ddt.ddt class EdxNotesPluginTest(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/grades/apps.py b/lms/djangoapps/grades/apps.py index c65e8722b6d7..fba54c065e82 100644 --- a/lms/djangoapps/grades/apps.py +++ b/lms/djangoapps/grades/apps.py @@ -43,6 +43,6 @@ def ready(self): # Can't import models at module level in AppConfigs, and models get # included from the signal handlers from .signals import handlers # pylint: disable=unused-import - if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'): + if settings.ENABLE_SPECIAL_EXAMS: from .services import GradesService set_runtime_service('grades', GradesService()) diff --git a/lms/djangoapps/grades/subsection_grade_factory.py b/lms/djangoapps/grades/subsection_grade_factory.py index 7e6fea6c0995..4818f22986c0 100644 --- a/lms/djangoapps/grades/subsection_grade_factory.py +++ b/lms/djangoapps/grades/subsection_grade_factory.py @@ -104,7 +104,7 @@ def update(self, subsection, only_if_higher=None, score_deleted=False, force_upd ) self._update_saved_subsection_grade(subsection.location, grade_model) - if settings.FEATURES.get('ENABLE_COURSE_ASSESSMENT_GRADE_CHANGE_SIGNAL'): + if settings.ENABLE_COURSE_ASSESSMENT_GRADE_CHANGE_SIGNAL: COURSE_ASSESSMENT_GRADE_CHANGED.send( sender=self, course_id=self.course_data.course_key, diff --git a/lms/djangoapps/instructor/apps.py b/lms/djangoapps/instructor/apps.py index d22c8b0aa1ad..2cebcccecd51 100644 --- a/lms/djangoapps/instructor/apps.py +++ b/lms/djangoapps/instructor/apps.py @@ -37,6 +37,6 @@ class InstructorConfig(AppConfig): def ready(self): from . import handlers # pylint: disable=unused-import,import-outside-toplevel - if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'): + if settings.ENABLE_SPECIAL_EXAMS: from .services import InstructorService set_runtime_service('instructor', InstructorService()) diff --git a/lms/djangoapps/instructor/enrollment.py b/lms/djangoapps/instructor/enrollment.py index 85eb5bac1ce8..eecb0c278c7a 100644 --- a/lms/djangoapps/instructor/enrollment.py +++ b/lms/djangoapps/instructor/enrollment.py @@ -492,7 +492,7 @@ def get_email_params(course, auto_enroll, secure=True, course_key=None, display_ # We can't get the url to the course's About page if the marketing site is enabled. course_about_url = None - if not settings.FEATURES.get('ENABLE_MKTG_SITE', False): + if not settings.ENABLE_MKTG_SITE: course_about_url = '{proto}://{site}{path}'.format( proto=protocol, site=stripped_site_name, diff --git a/lms/djangoapps/instructor/settings/common.py b/lms/djangoapps/instructor/settings/common.py index c8609d875014..f7d79cb0339e 100644 --- a/lms/djangoapps/instructor/settings/common.py +++ b/lms/djangoapps/instructor/settings/common.py @@ -9,7 +9,7 @@ def plugin_settings(settings): ### Analytics Dashboard (Insights) settings settings.ANALYTICS_DASHBOARD_URL = "" settings.ANALYTICS_DASHBOARD_NAME = _('Your Platform Insights') - # .. toggle_name: FEATURES['DISPLAY_ANALYTICS_ENROLLMENTS'] + # .. toggle_name: DISPLAY_ANALYTICS_ENROLLMENTS # .. toggle_implementation: DjangoSetting # .. toggle_default: True # .. toggle_description: Enable display of enrollment counts in instructor dashboard and @@ -19,7 +19,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/5838 settings.DISPLAY_ANALYTICS_ENROLLMENTS = True - # .. toggle_name: FEATURES['ENABLE_CCX_ANALYTICS_DASHBOARD_URL'] + # .. toggle_name: ENABLE_CCX_ANALYTICS_DASHBOARD_URL # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: Display the 'Analytics' tab in the instructor dashboard for CCX courses. @@ -30,7 +30,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/13196 settings.ENABLE_CCX_ANALYTICS_DASHBOARD_URL = False - # .. setting_name: FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] + # .. setting_name: MAX_ENROLLMENT_INSTR_BUTTONS # .. setting_default: 200 # .. setting_description: Disable instructor dashboard buttons for downloading course data # when enrollment exceeds this number. The number indicates the maximum allowed enrollments @@ -38,7 +38,7 @@ def plugin_settings(settings): # courses will have disabled buttons at the instructor dashboard. settings.MAX_ENROLLMENT_INSTR_BUTTONS = 200 - # .. toggle_name: FEATURES['ENABLE_GRADE_DOWNLOADS'] + # .. toggle_name: ENABLE_GRADE_DOWNLOADS # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: Enable grade CSV downloads from the instructor dashboard. Grade @@ -49,7 +49,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/11286 settings.ENABLE_GRADE_DOWNLOADS = False - # .. toggle_name: FEATURES['ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'] + # .. toggle_name: ALLOW_COURSE_STAFF_GRADE_DOWNLOADS # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: Enable to give course staff unrestricted access to grade downloads; @@ -59,7 +59,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/1750 settings.ALLOW_COURSE_STAFF_GRADE_DOWNLOADS = False - # .. toggle_name: FEATURES['ALLOW_AUTOMATED_SIGNUPS'] + # .. toggle_name: ALLOW_AUTOMATED_SIGNUPS # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: Enable to show a section in the membership tab of the instructor @@ -70,7 +70,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/5670 settings.ALLOW_AUTOMATED_SIGNUPS = False - # .. toggle_name: FEATURES['ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS'] + # .. toggle_name: ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: When True, the CSV file that contains a list of @@ -82,7 +82,7 @@ def plugin_settings(settings): # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/21260 settings.ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS = False - # .. toggle_name: FEATURES['CERTIFICATES_INSTRUCTOR_GENERATION'] # lint-amnesty, pylint: disable=annotation-missing-token + # .. toggle_name: CERTIFICATES_INSTRUCTOR_GENERATION # lint-amnesty, pylint: disable=annotation-missing-token # .. toggle_implementation: DjangoSetting # .. toggle_default: False # .. toggle_description: Enable to allow batch generation of certificates from the instructor dashboard. @@ -98,7 +98,7 @@ def plugin_settings(settings): # .. toggle_use_cases: opt_in settings.ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE = False - # .. toggle_name: FEATURES['BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT'] + # .. toggle_name: BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT # .. toggle_implementation: DjangoSetting # .. toggle_default: True # .. toggle_description: Controls if the "Notify users by email" checkbox in the batch diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 09b91d362b28..ca4c0ef58a4b 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -285,7 +285,7 @@ def post(self, request, course_id): # pylint: disable=too-many-statements """ if not configuration_helpers.get_value( 'ALLOW_AUTOMATED_SIGNUPS', - settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False), + settings.ALLOW_AUTOMATED_SIGNUPS, ): return HttpResponseForbidden() @@ -341,7 +341,7 @@ def post(self, request, course_id): # pylint: disable=too-many-statements already_warned_not_cohorted = False extra_fields_is_enabled = configuration_helpers.get_value( 'ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS', - settings.FEATURES.get('ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS', False), + settings.ENABLE_AUTOMATED_SIGNUPS_EXTRA_FIELDS, ) # Iterate each student in the uploaded csv file. diff --git a/lms/djangoapps/instructor/views/gradebook_api.py b/lms/djangoapps/instructor/views/gradebook_api.py index b4de0b73e627..01a60223524d 100644 --- a/lms/djangoapps/instructor/views/gradebook_api.py +++ b/lms/djangoapps/instructor/views/gradebook_api.py @@ -106,7 +106,7 @@ def get_grade_book_page(request, course, course_key): def spoc_gradebook(request, course_id): """ Show the gradebook for this course: - - Only shown for courses with enrollment < settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") + - Only shown for courses with enrollment < settings.MAX_ENROLLMENT_INSTR_BUTTONS - Only displayed to course staff """ course_key = CourseKey.from_string(course_id) diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 2cc86c42464b..9e3b666494cf 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -92,7 +92,7 @@ def show_analytics_dashboard_message(course_key): course_key (CourseLocator): The course locator to display the analytics dashboard message on. """ if hasattr(course_key, 'ccx'): - ccx_analytics_enabled = settings.FEATURES.get('ENABLE_CCX_ANALYTICS_DASHBOARD_URL', False) + ccx_analytics_enabled = settings.ENABLE_CCX_ANALYTICS_DASHBOARD_URL return settings.ANALYTICS_DASHBOARD_URL and ccx_analytics_enabled return settings.ANALYTICS_DASHBOARD_URL @@ -208,7 +208,7 @@ def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable # and enable self-generated certificates for a course. # Note: This is hidden for all CCXs certs_enabled = certs_api.is_certificate_generation_enabled() and not hasattr(course_key, 'ccx') - certs_instructor_enabled = settings.FEATURES.get('ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE', False) + certs_instructor_enabled = settings.ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE if certs_enabled and (access['admin'] or (access['instructor'] and certs_instructor_enabled)): sections.append(_section_certificates(course)) @@ -258,7 +258,7 @@ def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable 'generate_bulk_certificate_exceptions_url': generate_bulk_certificate_exceptions_url, 'certificate_exception_view_url': certificate_exception_view_url, 'certificate_invalidation_view_url': certificate_invalidation_view_url, - 'xqa_server': settings.FEATURES.get('XQA_SERVER', "http://your_xqa_server.com"), + 'xqa_server': settings.XQA_SERVER, } context_from_plugins = get_plugins_view_context( @@ -366,7 +366,7 @@ def _section_certificates(course): for cert_status in example_cert_status ) ) - instructor_generation_enabled = settings.FEATURES.get('CERTIFICATES_INSTRUCTOR_GENERATION', False) + instructor_generation_enabled = settings.CERTIFICATES_INSTRUCTOR_GENERATION certificate_statuses_with_count = { certificate['status']: certificate['count'] for certificate in certs_api.get_unique_certificate_statuses(course.id) @@ -463,7 +463,7 @@ def _section_course_info(course, access): 'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': str(course_key)}), } - if settings.FEATURES.get('DISPLAY_ANALYTICS_ENROLLMENTS'): + if settings.DISPLAY_ANALYTICS_ENROLLMENTS: section_data['enrollment_count'] = CourseEnrollment.objects.enrollment_counts(course_key) if show_analytics_dashboard_message(course_key): @@ -494,7 +494,7 @@ def _section_course_info(course, access): def _section_membership(course, access): """ Provide data for the corresponding dashboard section """ course_key = course.id - ccx_enabled = settings.FEATURES.get('CUSTOM_COURSES_EDX', False) and course.enable_ccx + ccx_enabled = settings.CUSTOM_COURSES_EDX and course.enable_ccx section_data = { 'section_key': 'membership', @@ -635,7 +635,7 @@ def _section_data_download(course, access): course_key = course.id show_proctored_report_button = ( - settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and + settings.ENABLE_SPECIAL_EXAMS and course.enable_proctored_exams ) section_key = 'data_download_2' if data_download_v2_is_enabled() else 'data_download' @@ -734,7 +734,7 @@ def _section_send_email(course, access): 'list_email_content', kwargs={'course_id': str(course_key)} ), } - if settings.FEATURES.get("ENABLE_NEW_BULK_EMAIL_EXPERIENCE", False) is not False: + if settings.ENABLE_NEW_BULK_EMAIL_EXPERIENCE is not False: section_data[ "communications_mfe_url" ] = f"{settings.COMMUNICATIONS_MICROFRONTEND_URL}/courses/{str(course_key)}/bulk_email" @@ -799,7 +799,7 @@ def _section_open_response_assessment(request, course, openassessment_blocks, ac section_data = { 'fragment': block.render('ora_blocks_listing_view', context={ 'ora_items': ora_items, - 'ora_item_view_enabled': settings.FEATURES.get('ENABLE_XBLOCK_VIEW_ENDPOINT', False) + 'ora_item_view_enabled': settings.ENABLE_XBLOCK_VIEW_ENDPOINT }), 'section_key': 'open_response_assessment', 'section_display_name': _('Open Responses'), diff --git a/lms/djangoapps/instructor/views/serializers_v2.py b/lms/djangoapps/instructor/views/serializers_v2.py index 6251dc5c50e1..e66a0c728037 100644 --- a/lms/djangoapps/instructor/views/serializers_v2.py +++ b/lms/djangoapps/instructor/views/serializers_v2.py @@ -172,7 +172,7 @@ def get_tabs(self, data): # Note: This is hidden for all CCXs certs_enabled = CertificateGenerationConfiguration.current().enabled and not hasattr(course_key, 'ccx') - certs_instructor_enabled = settings.FEATURES.get('ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE', False) + certs_instructor_enabled = settings.ENABLE_CERTIFICATES_INSTRUCTOR_MANAGE if certs_enabled and access['admin'] or (access['instructor'] and certs_instructor_enabled): tabs.append({ diff --git a/lms/djangoapps/instructor_task/tasks_helper/grades.py b/lms/djangoapps/instructor_task/tasks_helper/grades.py index edbe6b4f2e80..058b14f33cb5 100644 --- a/lms/djangoapps/instructor_task/tasks_helper/grades.py +++ b/lms/djangoapps/instructor_task/tasks_helper/grades.py @@ -911,7 +911,7 @@ def _build_student_data( ]) student_data = [] - max_count = settings.FEATURES.get('MAX_PROBLEM_RESPONSES_COUNT') + max_count = settings.MAX_PROBLEM_RESPONSES_COUNT store = modulestore() user_state_client = DjangoXBlockUserStateClient() diff --git a/lms/djangoapps/lti_provider/views.py b/lms/djangoapps/lti_provider/views.py index 4f6f2f9a93d7..a328e28740e3 100644 --- a/lms/djangoapps/lti_provider/views.py +++ b/lms/djangoapps/lti_provider/views.py @@ -55,7 +55,7 @@ def lti_launch(request, course_id, usage_id): - The launch data is correctly signed using a known client key/secret pair """ - if not settings.FEATURES['ENABLE_LTI_PROVIDER']: + if not settings.ENABLE_LTI_PROVIDER: log.info('LTI provider feature is disabled.') return HttpResponseForbidden() diff --git a/lms/djangoapps/mfe_config_api/views.py b/lms/djangoapps/mfe_config_api/views.py index 0ab71b151b88..b40b727abeff 100644 --- a/lms/djangoapps/mfe_config_api/views.py +++ b/lms/djangoapps/mfe_config_api/views.py @@ -101,7 +101,7 @@ def _get_legacy_config() -> dict: return { "ENABLE_COURSE_SORTING_BY_START_DATE": configuration_helpers.get_value( "ENABLE_COURSE_SORTING_BY_START_DATE", - settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"] + settings.ENABLE_COURSE_SORTING_BY_START_DATE ), "HOMEPAGE_PROMO_VIDEO_YOUTUBE_ID": configuration_helpers.get_value( "homepage_promo_video_youtube_id", @@ -115,6 +115,6 @@ def _get_legacy_config() -> dict: "course_about_twitter_account", settings.PLATFORM_TWITTER_ACCOUNT ), - "NON_BROWSABLE_COURSES": not settings.FEATURES.get("COURSES_ARE_BROWSABLE"), - "ENABLE_COURSE_DISCOVERY": settings.FEATURES["ENABLE_COURSE_DISCOVERY"], + "NON_BROWSABLE_COURSES": not settings.COURSES_ARE_BROWSABLE, + "ENABLE_COURSE_DISCOVERY": settings.ENABLE_COURSE_DISCOVERY, } diff --git a/lms/djangoapps/teams/__init__.py b/lms/djangoapps/teams/__init__.py index f2600b66dbc6..d786c5e2dff6 100644 --- a/lms/djangoapps/teams/__init__.py +++ b/lms/djangoapps/teams/__init__.py @@ -12,4 +12,4 @@ def is_feature_enabled(course): """ Returns True if the teams feature is enabled. """ - return settings.FEATURES.get('ENABLE_TEAMS', False) and course.teams_enabled + return settings.ENABLE_TEAMS and course.teams_enabled diff --git a/lms/djangoapps/teams/management/commands/reindex_course_team.py b/lms/djangoapps/teams/management/commands/reindex_course_team.py index 486325a5697e..d9c42e42ef0c 100644 --- a/lms/djangoapps/teams/management/commands/reindex_course_team.py +++ b/lms/djangoapps/teams/management/commands/reindex_course_team.py @@ -57,7 +57,7 @@ def handle(self, *args, **options): if not options['course_team_ids']: raise CommandError('At least one course_team_id or --all needs to be specified') - if not settings.FEATURES.get('ENABLE_TEAMS', False): + if not settings.ENABLE_TEAMS: raise CommandError('ENABLE_TEAMS must be enabled to use course team indexing') if options['all']: diff --git a/lms/djangoapps/teams/plugins.py b/lms/djangoapps/teams/plugins.py index 9ef932fe21ec..cae9a0ff5631 100644 --- a/lms/djangoapps/teams/plugins.py +++ b/lms/djangoapps/teams/plugins.py @@ -63,7 +63,7 @@ def is_available(cls, course_key: CourseKey) -> bool: """ if not ENABLE_TEAMS_APP.is_enabled(): return False - return settings.FEATURES.get("ENABLE_TEAMS", False) + return settings.ENABLE_TEAMS @classmethod def is_enabled(cls, course_key: CourseKey) -> bool: diff --git a/lms/djangoapps/verify_student/urls.py b/lms/djangoapps/verify_student/urls.py index 6438eea73ea0..748781867fef 100644 --- a/lms/djangoapps/verify_student/urls.py +++ b/lms/djangoapps/verify_student/urls.py @@ -121,7 +121,7 @@ ] # Fake response page for incourse reverification ( software secure ) -if settings.FEATURES.get('ENABLE_SOFTWARE_SECURE_FAKE'): +if settings.ENABLE_SOFTWARE_SECURE_FAKE: from lms.djangoapps.verify_student.tests.fake_software_secure import SoftwareSecureFakeView urlpatterns += [ path('software-secure-fake-response', SoftwareSecureFakeView.as_view()), diff --git a/lms/djangoapps/verify_student/utils.py b/lms/djangoapps/verify_student/utils.py index 3dcde96d929f..64d47dbff81a 100644 --- a/lms/djangoapps/verify_student/utils.py +++ b/lms/djangoapps/verify_student/utils.py @@ -136,7 +136,7 @@ def auto_verify_for_testing_enabled(override=None): """ if override is not None: return override - return settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING') + return settings.AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING def can_verify_now(verification_status, expiration_datetime): diff --git a/lms/envs/common.py b/lms/envs/common.py index 917dd025e96f..9b16a13403b7 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -84,18 +84,8 @@ # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/2425 DISPLAY_DEBUG_INFO_TO_STAFF = True -# .. toggle_name: settings.DISPLAY_HISTOGRAMS_TO_STAFF -# .. toggle_implementation: DjangoSetting -# .. toggle_default: False -# .. toggle_description: This displays histograms in the Staff Debug Info panel to course staff. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2014-02-13 -# .. toggle_warning: Generating histograms requires scanning the courseware_studentmodule table on each view. This -# can make staff access to courseware very slow on large courses. -# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/2425 -DISPLAY_HISTOGRAMS_TO_STAFF = False # For large courses this slows down courseware access for staff. -REROUTE_ACTIVATION_EMAIL = False # nonempty string = address for all activation emails +REROUTE_ACTIVATION_EMAIL = None # nonempty string = address for all activation emails ENABLE_DISCUSSION_HOME_PANEL = False @@ -135,7 +125,6 @@ # Django's admin site and will be inaccessible to the superuser. # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/829 ENABLE_DJANGO_ADMIN_SITE = True -ENABLE_LMS_MIGRATION = False # .. toggle_name: settings.ENABLE_MASQUERADE # .. toggle_implementation: DjangoSetting @@ -290,16 +279,6 @@ # defaults, so that we maintain current behavior ALLOW_WIKI_ROOT_ACCESS = True -# .. toggle_name: settings.ENABLE_THIRD_PARTY_AUTH -# .. toggle_implementation: DjangoSetting -# .. toggle_default: False -# .. toggle_description: Turn on third-party auth. Disabled for now because full implementations are not yet -# available. Remember to run migrations if you enable this; we don't create tables by default. This feature can -# be enabled on a per-site basis. When enabling this feature, remember to define the allowed authentication -# backends with the AUTHENTICATION_BACKENDS setting. -# .. toggle_use_cases: open_edx -# .. toggle_creation_date: 2014-09-15 -ENABLE_THIRD_PARTY_AUTH = False # Prevent concurrent logins per user PREVENT_CONCURRENT_LOGINS = True @@ -362,12 +341,6 @@ # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/6588 ENABLE_FOOTER_MOBILE_APP_LINKS = False -# For easily adding modes to courses during acceptance testing -MODE_CREATION_FOR_TESTING = False - -# For caching programs in contexts where the LMS can only -# be reached over HTTP. -EXPOSE_CACHE_PROGRAMS_ENDPOINT = False # Courseware search feature # .. toggle_name: settings.ENABLE_COURSEWARE_SEARCH @@ -544,17 +517,6 @@ # .. toggle_tickets: https://github.com/openedx/edx-platform/pull/18298 ENABLE_ACCOUNT_DELETION = True -# .. toggle_name: settings.ENABLE_AUTHN_MICROFRONTEND -# .. toggle_implementation: DjangoSetting -# .. toggle_default: False -# .. toggle_description: Supports staged rollout of a new micro-frontend-based implementation of the logistration. -# .. toggle_use_cases: temporary, open_edx -# .. toggle_creation_date: 2020-09-08 -# .. toggle_target_removal_date: None -# .. toggle_tickets: 'https://github.com/openedx/edx-platform/pull/24908' -# .. toggle_warning: Also set settings.AUTHN_MICROFRONTEND_URL for rollout. This temporary feature -# toggle does not have a target removal date. -ENABLE_AUTHN_MICROFRONTEND = os.environ.get("EDXAPP_ENABLE_AUTHN_MFE", False) # .. toggle_name: settings.ENABLE_CATALOG_MICROFRONTEND # .. toggle_implementation: DjangoSetting @@ -3172,3 +3134,17 @@ def _should_send_certificate_events(settings): SSL_AUTH_DN_FORMAT_STRING = ( "/C=US/ST=Massachusetts/O=Massachusetts Institute of Technology/OU=Client CA v1/CN={0}/emailAddress={1}" ) + + +# .. toggle_name: ENABLE_FORUM_DAILY_DIGEST +# .. toggle_implementation: DjangoSetting +# .. toggle_default: True +# .. toggle_description: Set to True to enable forum notification features. +# .. toggle_category: discussion +# .. toggle_use_cases: open_edx +# .. toggle_creation_date: 2020-03-09 +# .. toggle_expiration_date: None +# .. toggle_tickets: None +# .. toggle_status: supported +# .. toggle_warnings: None +ENABLE_FORUM_DAILY_DIGEST = True diff --git a/lms/templates/courses_list.html b/lms/templates/courses_list.html index 7967160f603d..22b6a3299ea2 100644 --- a/lms/templates/courses_list.html +++ b/lms/templates/courses_list.html @@ -5,7 +5,7 @@
      - % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): + % if settings.COURSES_ARE_BROWSABLE:
        ## limiting the course number by using HOMEPAGE_COURSE_MAX as the maximum number of courses diff --git a/lms/templates/courseware/course_navigation.html b/lms/templates/courseware/course_navigation.html index a0a784c31813..e76ec1e93263 100644 --- a/lms/templates/courseware/course_navigation.html +++ b/lms/templates/courseware/course_navigation.html @@ -21,7 +21,7 @@ if course is not None: include_special_exams = ( request.user.is_authenticated and - settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and + settings.ENABLE_SPECIAL_EXAMS and (course.enable_proctored_exams or course.enable_timed_exams) ) diff --git a/lms/templates/courseware/courses.html b/lms/templates/courseware/courses.html index 11ad5079ea65..d97e9a62ecb1 100644 --- a/lms/templates/courseware/courses.html +++ b/lms/templates/courseware/courses.html @@ -6,7 +6,7 @@ %> <%inherit file="../main.html" /> <% - course_discovery_enabled = settings.FEATURES.get('ENABLE_COURSE_DISCOVERY') + course_discovery_enabled = settings.ENABLE_COURSE_DISCOVERY %> <%namespace name='static' file='../static_content.html'/> diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 6149418035ca..de6c016525b3 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -75,7 +75,7 @@ }); }); - % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'): + % if settings.ENABLE_DASHBOARD_SEARCH: <%static:require_module module_name="course_search/js/dashboard_search_factory" class_name="DashboardSearchFactory"> DashboardSearchFactory(); @@ -240,7 +240,7 @@ % if empty_dashboard_message:

        ${empty_dashboard_message | n, decode.utf8}

        %endif - % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): + % if settings.COURSES_ARE_BROWSABLE: ${_("Explore courses")} @@ -277,7 +277,7 @@

        ${course_dir}

%endif - % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'): + % if settings.ENABLE_DASHBOARD_SEARCH: