diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4507bcccf9150ccc4e62a7542eea2ec1b9e99762..a3750864123381e8ccbcac512aa44bf702415caa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,10 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +Common: Switch over from MITX_FEATURES to just FEATURES. To override items in + the FEATURES dict, the environment variable you must set to do so is also + now called FEATURES instead of MITX_FEATURES. + Blades: Fix Numerical input to support mathematical operations. BLD-525. Blades: Improve calculator's tooltip accessibility. Add possibility to navigate diff --git a/cms/djangoapps/auth/authz.py b/cms/djangoapps/auth/authz.py index 1a1f138cb588a6bc2ae15e916ab5060edf79c27b..a5d00e14c1e2026604ba5a0215a371ebf2e26351 100644 --- a/cms/djangoapps/auth/authz.py +++ b/cms/djangoapps/auth/authz.py @@ -261,11 +261,11 @@ def is_user_in_creator_group(user): return True # On edx, we only allow edX staff to create courses. This may be relaxed in the future. - if settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False): + if settings.FEATURES.get('DISABLE_COURSE_CREATION', False): return False # Feature flag for using the creator group setting. Will be removed once the feature is complete. - if settings.MITX_FEATURES.get('ENABLE_CREATOR_GROUP', False): + if settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): return user.groups.filter(name=COURSE_CREATOR_GROUP_NAME).count() > 0 return True diff --git a/cms/djangoapps/auth/tests/test_authz.py b/cms/djangoapps/auth/tests/test_authz.py index 69050539cf5809233dd20dca0404a4e4d435e932..6bbb8d0a41916016d908ff065d0fc9a8576cef5b 100644 --- a/cms/djangoapps/auth/tests/test_authz.py +++ b/cms/djangoapps/auth/tests/test_authz.py @@ -33,7 +33,7 @@ class CreatorGroupTest(TestCase): def test_creator_group_enabled_but_empty(self): """ Tests creator group feature on, but group empty. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): self.assertFalse(is_user_in_creator_group(self.user)) # Make user staff. This will cause is_user_in_creator_group to return True. @@ -42,7 +42,7 @@ class CreatorGroupTest(TestCase): def test_creator_group_enabled_nonempty(self): """ Tests creator group feature on, user added. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): self.assertTrue(add_user_to_creator_group(self.admin, self.user)) self.assertTrue(is_user_in_creator_group(self.user)) @@ -70,7 +70,7 @@ class CreatorGroupTest(TestCase): def test_course_creation_disabled(self): """ Tests that the COURSE_CREATION_DISABLED flag overrides course creator group settings. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', + with mock.patch.dict('django.conf.settings.FEATURES', {'DISABLE_COURSE_CREATION': True, "ENABLE_CREATOR_GROUP": True}): # Add user to creator group. self.assertTrue(add_user_to_creator_group(self.admin, self.user)) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 0aaf2dfb299244f6d06b53a59dc4565790f7ad05..62c4d6b145280eeb21d1853150c8ed2067499b1b 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -1506,31 +1506,31 @@ class ContentStoreTest(ModuleStoreTestCase): def test_create_course_with_course_creation_disabled_staff(self): """Test new course creation -- course creation disabled, but staff access.""" - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'DISABLE_COURSE_CREATION': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'DISABLE_COURSE_CREATION': True}): self.assert_created_course() def test_create_course_with_course_creation_disabled_not_staff(self): """Test new course creation -- error path for course creation disabled, not staff access.""" - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'DISABLE_COURSE_CREATION': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'DISABLE_COURSE_CREATION': True}): self.user.is_staff = False self.user.save() self.assert_course_permission_denied() def test_create_course_no_course_creators_staff(self): """Test new course creation -- course creation group enabled, staff, group is empty.""" - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_CREATOR_GROUP': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_CREATOR_GROUP': True}): self.assert_created_course() def test_create_course_no_course_creators_not_staff(self): """Test new course creation -- error path for course creator group enabled, not staff, group is empty.""" - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): self.user.is_staff = False self.user.save() self.assert_course_permission_denied() def test_create_course_with_course_creator(self): """Test new course creation -- use course creator group""" - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): add_user_to_creator_group(self.user, self.user) self.assert_created_course() diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index 792b28fe4da66e9f3861be1e53775b3e73de57d0..1801e7c8dc903a3da6333071569eb79cd2942f1f 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -106,7 +106,7 @@ class CourseDetailsTestCase(CourseTestCase): def test_marketing_site_fetch(self): settings_details_url = self.course_locator.url_reverse('settings/details/') - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): response = self.client.get_html(settings_details_url) self.assertNotContains(response, "Course Summary Page") self.assertNotContains(response, "Send a note to students via email") @@ -127,7 +127,7 @@ class CourseDetailsTestCase(CourseTestCase): def test_regular_site_fetch(self): settings_details_url = self.course_locator.url_reverse('settings/details/') - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': False}): response = self.client.get_html(settings_details_url) self.assertContains(response, "Course Summary Page") self.assertContains(response, "Send a note to students via email") diff --git a/cms/djangoapps/contentstore/tests/test_request_event.py b/cms/djangoapps/contentstore/tests/test_request_event.py index 0126de66c6194c9d1ff0d17eb9326bc4bdb91503..166187ee587e51dfa89dab7aad0e507824827309 100644 --- a/cms/djangoapps/contentstore/tests/test_request_event.py +++ b/cms/djangoapps/contentstore/tests/test_request_event.py @@ -20,7 +20,7 @@ class CMSLogTest(TestCase): {"event": "my_event", "event_type": "my_event_type", "page": "my_page"}, {"event": "{'json': 'object'}", "event_type": unichr(512), "page": "my_page"} ] - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): for request_params in requests: response = self.client.post(reverse(cms_user_track), request_params) self.assertEqual(response.status_code, 204) @@ -34,7 +34,7 @@ class CMSLogTest(TestCase): {"event": "my_event", "event_type": "my_event_type", "page": "my_page"}, {"event": "{'json': 'object'}", "event_type": unichr(512), "page": "my_page"} ] - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): for request_params in requests: response = self.client.get(reverse(cms_user_track), request_params) self.assertEqual(response.status_code, 204) diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index 5311396f2fb067b865b2605f209060c193737caa..514fd802782d37fa6f8d8b216c39c3a1eba29df6 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -28,33 +28,33 @@ class LMSLinksTestCase(TestCase): @override_settings(MKTG_URLS={'ROOT': 'dummy-root'}) def about_page_marketing_site_test(self): """ Get URL for about page, marketing root present. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): self.assertEquals(self.get_about_page_link(), "//dummy-root/courses/mitX/101/test/about") - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': False}): self.assertEquals(self.get_about_page_link(), "//localhost:8000/courses/mitX/101/test/about") @override_settings(MKTG_URLS={'ROOT': 'http://www.dummy'}) def about_page_marketing_site_remove_http_test(self): """ Get URL for about page, marketing root present, remove http://. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): self.assertEquals(self.get_about_page_link(), "//www.dummy/courses/mitX/101/test/about") @override_settings(MKTG_URLS={'ROOT': 'https://www.dummy'}) def about_page_marketing_site_remove_https_test(self): """ Get URL for about page, marketing root present, remove https://. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): self.assertEquals(self.get_about_page_link(), "//www.dummy/courses/mitX/101/test/about") @override_settings(MKTG_URLS={'ROOT': 'www.dummyhttps://x'}) def about_page_marketing_site_https__edge_test(self): """ Get URL for about page, only remove https:// at the beginning of the string. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): self.assertEquals(self.get_about_page_link(), "//www.dummyhttps://x/courses/mitX/101/test/about") @override_settings(MKTG_URLS={}) def about_page_marketing_urls_not_set_test(self): """ Error case. ENABLE_MKTG_SITE is True, but there is either no MKTG_URLS, or no MKTG_URLS Root property. """ - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): self.assertEquals(self.get_about_page_link(), None) @override_settings(LMS_BASE=None) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 0a2ecbd37be0c456e403984f1cd8a3b8c1135fff..cf4bffc503b31c720df56d77fb9ac55b9e01b962 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -136,7 +136,7 @@ def get_lms_link_for_item(location, preview=False, course_id=None): if settings.LMS_BASE is not None: if preview: - lms_base = settings.MITX_FEATURES.get('PREVIEW_LMS_BASE') + lms_base = settings.FEATURES.get('PREVIEW_LMS_BASE') else: lms_base = settings.LMS_BASE @@ -155,7 +155,7 @@ def get_lms_link_for_about_page(location): """ Returns the url to the course about page from the location tuple. """ - if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False): + if settings.FEATURES.get('ENABLE_MKTG_SITE', False): if not hasattr(settings, 'MKTG_URLS'): log.exception("ENABLE_MKTG_SITE is True, but MKTG_URLS is not defined.") about_base = None diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 269b603effc051134a22ccfa641518aa7543e116..0a34045687231f368804b2709d414bf1713917d6 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -256,7 +256,7 @@ def unit_handler(request, tag=None, course_id=None, branch=None, version_guid=No break index = index + 1 - preview_lms_base = settings.MITX_FEATURES.get('PREVIEW_LMS_BASE') + preview_lms_base = settings.FEATURES.get('PREVIEW_LMS_BASE') preview_lms_link = ( '//{preview_lms_base}/courses/{org}/{course}/' diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 5680be8077848daac601f70e7b491588593cc0ee..61131fcc119ea28c7d1615640acc8c8afd0cc9b0 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -423,7 +423,7 @@ def settings_handler(request, tag=None, course_id=None, branch=None, version_gui 'lms_link_for_about_page': utils.get_lms_link_for_about_page(course_old_location), 'course_image_url': utils.course_image_url(course_module), 'details_url': locator.url_reverse('/settings/details/'), - 'about_page_editable': not settings.MITX_FEATURES.get( + 'about_page_editable': not settings.FEATURES.get( 'ENABLE_MKTG_SITE', False ), 'upload_asset_url': upload_asset_url @@ -822,9 +822,9 @@ def _get_course_creator_status(user): """ if user.is_staff: course_creator_status = 'granted' - elif settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False): + elif settings.FEATURES.get('DISABLE_COURSE_CREATION', False): course_creator_status = 'disallowed_for_this_site' - elif settings.MITX_FEATURES.get('ENABLE_CREATOR_GROUP', False): + elif settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): 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. diff --git a/cms/djangoapps/course_creators/admin.py b/cms/djangoapps/course_creators/admin.py index 87e17fabfa90f8e3c0da47716e6f00c488c7a9fb..5eaa8c4ac36decb92cbcef8d50fb8b58eb30518b 100644 --- a/cms/djangoapps/course_creators/admin.py +++ b/cms/djangoapps/course_creators/admin.py @@ -91,7 +91,7 @@ def send_user_notification_callback(sender, **kwargs): user = kwargs['user'] updated_state = kwargs['state'] - studio_request_email = settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL', '') + studio_request_email = settings.FEATURES.get('STUDIO_REQUEST_EMAIL', '') context = {'studio_request_email': studio_request_email} subject = render_to_string('emails/course_creator_subject.txt', context) @@ -118,7 +118,7 @@ def send_admin_notification_callback(sender, **kwargs): """ user = kwargs['user'] - studio_request_email = settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL', '') + studio_request_email = settings.FEATURES.get('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/course_creators/tests/test_admin.py b/cms/djangoapps/course_creators/tests/test_admin.py index aa293e008eeef4150b60e67c1ecbda950b4efe69..4d28f263997effafce6e9cc58b75eef555585352 100644 --- a/cms/djangoapps/course_creators/tests/test_admin.py +++ b/cms/djangoapps/course_creators/tests/test_admin.py @@ -69,7 +69,7 @@ class CourseCreatorAdminTest(TestCase): self.studio_request_email ) - with mock.patch.dict('django.conf.settings.MITX_FEATURES', self.enable_creator_group_patch): + with mock.patch.dict('django.conf.settings.FEATURES', self.enable_creator_group_patch): # User is initially unrequested. self.assertFalse(is_user_in_creator_group(self.user)) @@ -119,7 +119,7 @@ class CourseCreatorAdminTest(TestCase): else: self.assertEquals(base_num_emails, len(mail.outbox)) - with mock.patch.dict('django.conf.settings.MITX_FEATURES', self.enable_creator_group_patch): + with mock.patch.dict('django.conf.settings.FEATURES', self.enable_creator_group_patch): # E-mail message should be sent to admin only when new state is PENDING, regardless of what # previous state was (unless previous state was already PENDING). # E-mail message sent to user only on transition into and out of GRANTED state. @@ -159,7 +159,7 @@ class CourseCreatorAdminTest(TestCase): self.assertFalse(self.creator_admin.has_change_permission(self.request)) def test_rate_limit_login(self): - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_CREATOR_GROUP': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_CREATOR_GROUP': True}): post_params = {'username': self.user.username, 'password': 'wrong_password'} # try logging in 30 times, the default limit in the number of failed # login attempts in one 5 minute period before the rate gets limited diff --git a/cms/djangoapps/course_creators/tests/test_views.py b/cms/djangoapps/course_creators/tests/test_views.py index 95c50ffb76d4b134f7063943a16eab1d2e4d806d..dbd92365b7deb8e88ab39245b98b72ea5c6cbac3 100644 --- a/cms/djangoapps/course_creators/tests/test_views.py +++ b/cms/djangoapps/course_creators/tests/test_views.py @@ -46,7 +46,7 @@ class CourseCreatorView(TestCase): self.assertEqual('unrequested', get_course_creator_status(self.user)) def test_add_granted(self): - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): # Calling add_user_with_status_granted impacts is_user_in_course_group_role. self.assertFalse(is_user_in_creator_group(self.user)) @@ -60,7 +60,7 @@ class CourseCreatorView(TestCase): self.assertTrue(is_user_in_creator_group(self.user)) def test_update_creator_group(self): - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}): + with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}): self.assertFalse(is_user_in_creator_group(self.user)) update_course_creator_group(self.admin, self.user, True) self.assertTrue(is_user_in_creator_group(self.user)) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index afbdff7d3f0c2a5e3390078157c342ed5837e44c..67ecfa5689a9ad926c1fb951e77983b11d956167 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -87,7 +87,7 @@ PIPELINE = True STATICFILES_FINDERS += ('pipeline.finders.PipelineFinder', ) # Use the auto_auth workflow for creating users and logging them in -MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True +FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # HACK # Setting this flag to false causes imports to not load correctly in the lettuce python files diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 1b0c0ef6482fd5f40e1223169524432ca2aa0896..8853ccf431f6ec90fa7e16765f769ebf10e8a873 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -106,7 +106,7 @@ if STATIC_ROOT_BASE: EMAIL_BACKEND = ENV_TOKENS.get('EMAIL_BACKEND', EMAIL_BACKEND) EMAIL_FILE_PATH = ENV_TOKENS.get('EMAIL_FILE_PATH', None) LMS_BASE = ENV_TOKENS.get('LMS_BASE') -# Note that MITX_FEATURES['PREVIEW_LMS_BASE'] gets read in from the environment file. +# Note that FEATURES['PREVIEW_LMS_BASE'] gets read in from the environment file. SITE_NAME = ENV_TOKENS['SITE_NAME'] @@ -138,8 +138,8 @@ COURSES_WITH_UNSAFE_CODE = ENV_TOKENS.get("COURSES_WITH_UNSAFE_CODE", []) TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE) -for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items(): - MITX_FEATURES[feature] = value +for feature, value in ENV_TOKENS.get('FEATURES', {}).items(): + FEATURES[feature] = value LOGGING = get_logger_config(LOG_DIR, logging_env=ENV_TOKENS['LOGGING_ENV'], @@ -164,7 +164,7 @@ with open(CONFIG_ROOT / CONFIG_PREFIX + "auth.json") as auth_file: # Note that this is the Studio key. There is a separate key for the LMS. SEGMENT_IO_KEY = AUTH_TOKENS.get('SEGMENT_IO_KEY') if SEGMENT_IO_KEY: - MITX_FEATURES['SEGMENT_IO'] = ENV_TOKENS.get('SEGMENT_IO', False) + FEATURES['SEGMENT_IO'] = ENV_TOKENS.get('SEGMENT_IO', False) AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"] if AWS_ACCESS_KEY_ID == "": diff --git a/cms/envs/common.py b/cms/envs/common.py index 961a089a14f0e3f290cebf0b31a477f6d18fa715..a8c293b57f08843fd7660e665d1ff1efc281883f 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2,7 +2,7 @@ This is the common settings file, intended to set sane defaults. If you have a piece of configuration that's dependent on a set of feature flags being set, then create a function that returns the calculated value based on the value of -MITX_FEATURES[...]. Modules that extend this one can change the feature +FEATURES[...]. Modules that extend this one can change the feature configuration in an environment specific config file and re-calculate those values. @@ -14,7 +14,7 @@ Longer TODO: 1. Right now our treatment of static content in general and in particular course-specific static content is haphazard. 2. We should have a more disciplined approach to feature flagging, even if it - just means that we stick them in a dict called MITX_FEATURES. + just means that we stick them in a dict called FEATURES. 3. We need to handle configuration for multiple courses. This could be as multiple sites, but we do need a way to map their data assets. """ @@ -36,7 +36,7 @@ from dealer.git import git ############################ FEATURE CONFIGURATION ############################# -MITX_FEATURES = { +FEATURES = { 'USE_DJANGO_PIPELINE': True, 'GITHUB_PUSH': False, diff --git a/cms/envs/dev.py b/cms/envs/dev.py index ddf1708c875f34583e876d8a1cf17f53cb874647..6d47e65f23c41f08d54165f635b1534d7f86017f 100644 --- a/cms/envs/dev.py +++ b/cms/envs/dev.py @@ -76,7 +76,7 @@ DATABASES = { } LMS_BASE = "localhost:8000" -MITX_FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000" +FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000" REPOS = { 'edx4edx': { @@ -178,10 +178,10 @@ DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_MONGO_STACKTRACES = False # disable NPS survey in dev mode -MITX_FEATURES['STUDIO_NPS_SURVEY'] = False +FEATURES['STUDIO_NPS_SURVEY'] = False # Enable URL that shows information about the status of variuous services -MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True +FEATURES['ENABLE_SERVICE_STATUS'] = True ############################# SEGMENT-IO ################################## @@ -190,7 +190,7 @@ MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True import os SEGMENT_IO_KEY = os.environ.get('SEGMENT_IO_KEY') if SEGMENT_IO_KEY: - MITX_FEATURES['SEGMENT_IO'] = True + FEATURES['SEGMENT_IO'] = True ##################################################################### diff --git a/cms/envs/dev_ike.py b/cms/envs/dev_ike.py index 6e67f78f3666652d4ab8c0ced868cc3f3ddfed34..95ae33e328970bdfeef663e158a438092cf28081 100644 --- a/cms/envs/dev_ike.py +++ b/cms/envs/dev_ike.py @@ -9,8 +9,8 @@ from .common import * from .dev import * -MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True +FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True -MITX_FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss +FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') # django 1.4 for nginx ssl proxy diff --git a/cms/envs/dev_shared_preview.py b/cms/envs/dev_shared_preview.py index 119558ba0559e01c454c13f550631b950b76066f..ec488a68bafcde4ee3e12852ad1e610b04bbc3e6 100644 --- a/cms/envs/dev_shared_preview.py +++ b/cms/envs/dev_shared_preview.py @@ -9,4 +9,4 @@ the same process between preview and published from .dev import * -MITX_FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost:8000" +FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost:8000" diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index e25f092c9a84786df2c849d4197e743782c32136..fa41d5cef84af95102599edd7fbd7fbcac259101 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -24,7 +24,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' ################################# LMS INTEGRATION ############################# LMS_BASE = "localhost:8000" -MITX_FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE +FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE ################################# CELERY ###################################### diff --git a/cms/envs/test.py b/cms/envs/test.py index ef7133e0bd60c24a16a4abe2e12f8c02089aed4f..5edea467d36fed10b76a1e3b91ae5bb2deab9312 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -109,7 +109,7 @@ DATABASES = { } LMS_BASE = "localhost:8000" -MITX_FEATURES['PREVIEW_LMS_BASE'] = "preview" +FEATURES['PREVIEW_LMS_BASE'] = "preview" CACHES = { # This is the cache used for most things. Askbot will not work without a @@ -161,9 +161,9 @@ PASSWORD_HASHERS = ( SEGMENT_IO_KEY = '***REMOVED***' # disable NPS survey in test mode -MITX_FEATURES['STUDIO_NPS_SURVEY'] = False +FEATURES['STUDIO_NPS_SURVEY'] = False -MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True +FEATURES['ENABLE_SERVICE_STATUS'] = True # This is to disable a test under the common directory that will not pass when run under CMS -MITX_FEATURES['DISABLE_PASSWORD_RESET_EMAIL_TEST'] = True +FEATURES['DISABLE_PASSWORD_RESET_EMAIL_TEST'] = True diff --git a/cms/templates/index.html b/cms/templates/index.html index 572f40a865b617bb6f63099e241f1625b3da5291..6d3627e254c56aeb9ed9eb411cc20293596d9965 100644 --- a/cms/templates/index.html +++ b/cms/templates/index.html @@ -45,8 +45,8 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { % if course_creator_status=='granted': <a href="#" class="button new-button new-course-button"><i class="icon-plus icon-inline"></i> ${_("New Course")}</a> - % elif course_creator_status=='disallowed_for_this_site' and settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL',''): - <a href="mailto:${settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("Email staff to create course")}</a> + % elif course_creator_status=='disallowed_for_this_site' and settings.FEATURES.get('STUDIO_REQUEST_EMAIL',''): + <a href="mailto:${settings.FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("Email staff to create course")}</a> % endif </li> </ul> @@ -290,10 +290,10 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { </ol> </div> - % if course_creator_status=='disallowed_for_this_site' and settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL',''): + % if course_creator_status=='disallowed_for_this_site' and settings.FEATURES.get('STUDIO_REQUEST_EMAIL',''): <div class="bit"> <h3 class="title title-3">${_('Can I create courses in Studio?')}</h3> - <p>${_('In order to create courses in Studio, you must')} <a href="mailto:${settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("contact edX staff to help you create a course")}</a></p> + <p>${_('In order to create courses in Studio, you must')} <a href="mailto:${settings.FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("contact edX staff to help you create a course")}</a></p> </div> % endif diff --git a/cms/templates/widgets/qualaroo.html b/cms/templates/widgets/qualaroo.html index 04d10e08d166cd8ff7448f9b85e589a9e53ab153..1081c22c08dd721cc975991db035a1e3d64a0e2d 100644 --- a/cms/templates/widgets/qualaroo.html +++ b/cms/templates/widgets/qualaroo.html @@ -1,4 +1,4 @@ -% if settings.MITX_FEATURES.get('STUDIO_NPS_SURVEY'): +% if settings.FEATURES.get('STUDIO_NPS_SURVEY'): <!-- Qualaroo is used for net promoter score surveys --> <script type="text/javascript"> % if user.is_authenticated(): diff --git a/cms/templates/widgets/segment-io.html b/cms/templates/widgets/segment-io.html index d250e9c23b5d3234768c30070b50d0630055a3db..a90e08886d30a57e4c62124ef84f2e79cc561973 100644 --- a/cms/templates/widgets/segment-io.html +++ b/cms/templates/widgets/segment-io.html @@ -9,7 +9,7 @@ from xmodule.modulestore.django import loc_mapper %> % endif -% if settings.MITX_FEATURES.get('SEGMENT_IO'): +% if settings.FEATURES.get('SEGMENT_IO'): <!-- begin Segment.io --> <script type="text/javascript"> // if inside course, inject the course location into the JS namespace diff --git a/cms/urls.py b/cms/urls.py index e17d4c729a0f238cb5f2af96d2769d6482c7db83..07cd0d4bbbd74d2ca8b261f7038d93132c7d550c 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -101,7 +101,7 @@ urlpatterns += patterns('', url(r'^i18n.js$', 'django.views.i18n.javascript_catalog', js_info_dict), ) -if settings.MITX_FEATURES.get('ENABLE_SERVICE_STATUS'): +if settings.FEATURES.get('ENABLE_SERVICE_STATUS'): urlpatterns += patterns('', url(r'^status/', include('service_status.urls')), ) @@ -109,7 +109,7 @@ if settings.MITX_FEATURES.get('ENABLE_SERVICE_STATUS'): urlpatterns += patterns('', url(r'^admin/', include(admin.site.urls)),) # enable automatic login -if settings.MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING'): +if settings.FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING'): urlpatterns += ( url(r'^auto_auth$', 'student.views.auto_auth'), ) diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index e83f1b028f310d1688ada822b92e417f317b89ce..c2b56ffc3946b07c4c04dc1eccb51706e45c2652 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -35,13 +35,13 @@ def marketing_link(name): # link_map maps URLs from the marketing site to the old equivalent on # the Django site link_map = settings.MKTG_URL_LINK_MAP - if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE') and name in settings.MKTG_URLS: + if settings.FEATURES.get('ENABLE_MKTG_SITE') and name in settings.MKTG_URLS: # special case for when we only want the root marketing URL if name == 'ROOT': return settings.MKTG_URLS.get('ROOT') return settings.MKTG_URLS.get('ROOT') + settings.MKTG_URLS.get(name) # only link to the old pages when the marketing site isn't on - elif not settings.MITX_FEATURES.get('ENABLE_MKTG_SITE') and name in link_map: + elif not settings.FEATURES.get('ENABLE_MKTG_SITE') and name in link_map: # don't try to reverse disabled marketing links if link_map[name] is not None: return reverse(link_map[name]) diff --git a/common/djangoapps/edxmako/tests.py b/common/djangoapps/edxmako/tests.py index a4eb84eda8f255834a5bff2d470d82b18325c94d..882d6612d42b60ca391b7144dbadd997718e75b8 100644 --- a/common/djangoapps/edxmako/tests.py +++ b/common/djangoapps/edxmako/tests.py @@ -14,12 +14,12 @@ class ShortcutsTests(UrlResetMixin, TestCase): @override_settings(MKTG_URL_LINK_MAP={'ABOUT': 'login'}) def test_marketing_link(self): # test marketing site on - with patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + with patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': True}): expected_link = 'dummy-root/about-us' link = marketing_link('ABOUT') self.assertEquals(link, expected_link) # test marketing site off - with patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}): + with patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': False}): # we are using login because it is common across both cms and lms expected_link = reverse('login') link = marketing_link('ABOUT') diff --git a/common/djangoapps/external_auth/tests/test_openid_provider.py b/common/djangoapps/external_auth/tests/test_openid_provider.py index 808fb60bed70496c3d8cc5ec3e383683f0fbb0bb..cb7d0c0c14bb01b2a67b0f58d750fc506f5df892 100644 --- a/common/djangoapps/external_auth/tests/test_openid_provider.py +++ b/common/djangoapps/external_auth/tests/test_openid_provider.py @@ -72,8 +72,8 @@ class OpenIdProviderTest(TestCase): Tests of the OpenId login """ - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_begin_login_with_xrds_url(self): # the provider URL must be converted to an absolute URL in order to be @@ -100,8 +100,8 @@ class OpenIdProviderTest(TestCase): "got code {0} for url '{1}'. Expected code {2}" .format(resp.status_code, url, code)) - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_begin_login_with_login_url(self): # the provider URL must be converted to an absolute URL in order to be @@ -183,21 +183,21 @@ class OpenIdProviderTest(TestCase): "got code {0} for url '{1}'. Expected code {2}" .format(resp.status_code, url, code)) - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_open_id_setup(self): """ Attempt a standard successful login """ self.attempt_login(200) - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_invalid_namespace(self): """ Test for 403 error code when the namespace of the request is invalid""" self.attempt_login(403, ns="http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0") @override_settings(OPENID_PROVIDER_TRUSTED_ROOTS=['http://apps.cs50.edx.org']) - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_invalid_return_url(self): """ Test for 403 error code when the url""" self.attempt_login(403, return_to="http://apps.cs50.edx.or") @@ -224,15 +224,15 @@ class OpenIdProviderTest(TestCase): response = provider_login(request) return response - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_login_openid_handle_redirection(self): """ Test to see that we can handle login redirection properly""" response = self._send_bad_redirection_login() self.assertEquals(response.status_code, 302) - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_login_openid_handle_redirection_ratelimited(self): # try logging in 30 times, the default limit in the number of failed # log in attempts before the rate gets limited @@ -254,8 +254,8 @@ class OpenIdProviderLiveServerTest(LiveServerTestCase): Here we do the former. """ - @skipUnless(settings.MITX_FEATURES.get('AUTH_USE_OPENID') or - settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) + @skipUnless(settings.FEATURES.get('AUTH_USE_OPENID') or + settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'), True) def test_begin_login(self): # the provider URL must be converted to an absolute URL in order to be # used as an openid provider. diff --git a/common/djangoapps/external_auth/tests/test_shib.py b/common/djangoapps/external_auth/tests/test_shib.py index 80aabcb8f917ea6d57ba095cbcd725f59498a5f9..fdcf940449e02b35709962c2985f3e85cfcc1106 100644 --- a/common/djangoapps/external_auth/tests/test_shib.py +++ b/common/djangoapps/external_auth/tests/test_shib.py @@ -81,7 +81,7 @@ class ShibSPTest(ModuleStoreTestCase): def setUp(self): self.store = editable_modulestore() - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_exception_shib_login(self): """ Tests that we get the error page when there is no REMOTE_USER @@ -107,7 +107,7 @@ class ShibSPTest(ModuleStoreTestCase): self.assertIn(u'logged in via Shibboleth', args[0]) self.assertEquals(remote_user, args[1]) - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_shib_login(self): """ Tests that: @@ -207,7 +207,7 @@ class ShibSPTest(ModuleStoreTestCase): # no audit logging calls self.assertEquals(len(audit_log_calls), 0) - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_registration_form(self): """ Tests the registration form showing up with the proper parameters. @@ -237,7 +237,7 @@ class ShibSPTest(ModuleStoreTestCase): # clean up b/c we don't want existing ExternalAuthMap for the next run client.session['ExternalAuthMap'].delete() - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_registration_form_submit(self): """ Tests user creation after the registration form that pops is submitted. If there is no shib @@ -319,7 +319,7 @@ class ShibSPTest(ModuleStoreTestCase): Registration.objects.filter(user=user).delete() user.delete() - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_course_specific_login_and_reg(self): """ Tests that the correct course specific login and registration urls work for shib @@ -391,7 +391,7 @@ class ShibSPTest(ModuleStoreTestCase): '?course_id=DNE/DNE/DNE' + '&enrollment_action=enroll') - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_enrollment_limit_by_domain(self): """ Tests that the enrollmentDomain setting is properly limiting enrollment to those who have @@ -455,7 +455,7 @@ class ShibSPTest(ModuleStoreTestCase): self.assertEqual(response.status_code, 400) self.assertFalse(CourseEnrollment.is_enrolled(student, course.id)) - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_shib_login_enrollment(self): """ A functionality test that a student with an existing shib login diff --git a/common/djangoapps/external_auth/tests/test_ssl.py b/common/djangoapps/external_auth/tests/test_ssl.py index b5eb60de0d1fabd32f34ab2d0394afc17190cf70..13f5b9a73d127c3587b7cd61ae21df0164de1d3a 100644 --- a/common/djangoapps/external_auth/tests/test_ssl.py +++ b/common/djangoapps/external_auth/tests/test_ssl.py @@ -17,13 +17,13 @@ from django.test.utils import override_settings from external_auth.models import ExternalAuthMap import external_auth.views -MITX_FEATURES_WITH_SSL_AUTH = settings.MITX_FEATURES.copy() -MITX_FEATURES_WITH_SSL_AUTH['AUTH_USE_MIT_CERTIFICATES'] = True -MITX_FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP = MITX_FEATURES_WITH_SSL_AUTH.copy() -MITX_FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP['AUTH_USE_MIT_CERTIFICATES_IMMEDIATE_SIGNUP'] = True +FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy() +FEATURES_WITH_SSL_AUTH['AUTH_USE_MIT_CERTIFICATES'] = True +FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP = FEATURES_WITH_SSL_AUTH.copy() +FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP['AUTH_USE_MIT_CERTIFICATES_IMMEDIATE_SIGNUP'] = True -@override_settings(MITX_FEATURES=MITX_FEATURES_WITH_SSL_AUTH) +@override_settings(FEATURES=FEATURES_WITH_SSL_AUTH) class SSLClientTest(TestCase): """ Tests SSL Authentication code sections of external_auth @@ -94,7 +94,7 @@ class SSLClientTest(TestCase): User.objects.get(email=self.USER_EMAIL) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') - @override_settings(MITX_FEATURES=MITX_FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP) + @override_settings(FEATURES=FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP) def test_ssl_login_without_signup_lms(self): """ Test IMMEDIATE_SIGNUP feature flag and ensure the user account is automatically created @@ -114,7 +114,7 @@ class SSLClientTest(TestCase): self.fail('User did not get properly added to internal users, exception was {0}'.format(str(ex))) @unittest.skipUnless(settings.ROOT_URLCONF == 'cms.urls', 'Test only valid in cms') - @override_settings(MITX_FEATURES=MITX_FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP) + @override_settings(FEATURES=FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP) @unittest.skip def test_ssl_login_without_signup_cms(self): """ diff --git a/common/djangoapps/external_auth/views.py b/common/djangoapps/external_auth/views.py index b25e37a189d389810d719a8d56886b415b771094..2784737eea353906b83e630b22f4e68851ba3266 100644 --- a/common/djangoapps/external_auth/views.py +++ b/common/djangoapps/external_auth/views.py @@ -18,7 +18,7 @@ from django.core.urlresolvers import reverse from django.core.validators import validate_email from django.core.exceptions import ValidationError -if settings.MITX_FEATURES.get('AUTH_USE_CAS'): +if settings.FEATURES.get('AUTH_USE_CAS'): from django_cas.views import login as django_cas_login from student.models import UserProfile @@ -150,7 +150,7 @@ def _external_login_or_signup(request, eamap.save() log.info(u"External_Auth login_or_signup for %s : %s : %s : %s", external_domain, external_id, email, fullname) - uses_shibboleth = settings.MITX_FEATURES.get('AUTH_USE_SHIB') and external_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX) + uses_shibboleth = settings.FEATURES.get('AUTH_USE_SHIB') and external_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX) internal_user = eamap.user if internal_user is None: if uses_shibboleth: @@ -250,7 +250,7 @@ def _signup(request, eamap): # save this for use by student.views.create_account request.session['ExternalAuthMap'] = eamap - if settings.MITX_FEATURES.get('AUTH_USE_MIT_CERTIFICATES_IMMEDIATE_SIGNUP', ''): + if settings.FEATURES.get('AUTH_USE_MIT_CERTIFICATES_IMMEDIATE_SIGNUP', ''): # do signin immediately, by calling create_account, instead of asking # student to fill in form. MIT students already have information filed. username = eamap.external_email.split('@', 1)[0] @@ -278,9 +278,9 @@ def _signup(request, eamap): # Some openEdX instances can't have terms of service for shib users, like # according to Stanford's Office of General Counsel - uses_shibboleth = (settings.MITX_FEATURES.get('AUTH_USE_SHIB') and + uses_shibboleth = (settings.FEATURES.get('AUTH_USE_SHIB') and eamap.external_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX)) - if uses_shibboleth and settings.MITX_FEATURES.get('SHIB_DISABLE_TOS'): + if uses_shibboleth and settings.FEATURES.get('SHIB_DISABLE_TOS'): context['ask_for_tos'] = False # detect if full name is blank and ask for it from user @@ -349,7 +349,7 @@ def ssl_login_shortcut(fn): based on existing ExternalAuth record and MIT ssl certificate. """ def wrapped(*args, **kwargs): - if not settings.MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES']: + if not settings.FEATURES['AUTH_USE_MIT_CERTIFICATES']: return fn(*args, **kwargs) request = args[0] cert = _ssl_get_cert_from_request(request) @@ -372,7 +372,7 @@ def ssl_login_shortcut(fn): def ssl_login(request): """ This is called by branding.views.index when - MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True + FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True Used for MIT user authentication. This presumes the web server (nginx) has been configured to require specific client @@ -386,7 +386,7 @@ def ssl_login(request): Else continues on with student.views.index, and no authentication. """ # Just to make sure we're calling this only at MIT: - if not settings.MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES']: + if not settings.FEATURES['AUTH_USE_MIT_CERTIFICATES']: return HttpResponseForbidden() cert = _ssl_get_cert_from_request(request) @@ -540,7 +540,7 @@ def course_specific_login(request, course_id): return _redirect_with_get_querydict('signin_user', request.GET) # now the dispatching conditionals. Only shib for now - if settings.MITX_FEATURES.get('AUTH_USE_SHIB') and course.enrollment_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX): + if settings.FEATURES.get('AUTH_USE_SHIB') and course.enrollment_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX): return _redirect_with_get_querydict('shib-login', request.GET) # Default fallthrough to normal signin page @@ -559,7 +559,7 @@ def course_specific_register(request, course_id): return _redirect_with_get_querydict('register_user', request.GET) # now the dispatching conditionals. Only shib for now - if settings.MITX_FEATURES.get('AUTH_USE_SHIB') and course.enrollment_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX): + if settings.FEATURES.get('AUTH_USE_SHIB') and course.enrollment_domain.startswith(SHIBBOLETH_DOMAIN_PREFIX): # shib-login takes care of both registration and login flows return _redirect_with_get_querydict('shib-login', request.GET) diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html index 2a1308923aec361ae9addcc31cbd1ee354de33e3..6efcba7ced3c2cbf03e9672f9253e73714327915 100644 --- a/common/djangoapps/pipeline_mako/templates/static_content.html +++ b/common/djangoapps/pipeline_mako/templates/static_content.html @@ -11,7 +11,7 @@ except: %>${url}</%def> <%def name='css(group)'> - % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + % if settings.FEATURES['USE_DJANGO_PIPELINE']: ${compressed_css(group)} % else: % for filename in settings.PIPELINE_CSS[group]['source_filenames']: @@ -20,7 +20,7 @@ except: %endif </%def> <%def name='js(group)'> - % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + % if settings.FEATURES['USE_DJANGO_PIPELINE']: ${compressed_js(group)} % else: % for filename in settings.PIPELINE_JS[group]['source_filenames']: diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 02c9a38b82084fffe0bccd81c653dff5c94970c6..1ed6126e9b695613d2ab5865138e11d6a0b60511 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -695,7 +695,7 @@ def add_user_to_default_group(user, group): @receiver(post_save, sender=User) def update_user_information(sender, instance, created, **kwargs): - if not settings.MITX_FEATURES['ENABLE_DISCUSSION_SERVICE']: + if not settings.FEATURES['ENABLE_DISCUSSION_SERVICE']: # Don't try--it won't work, and it will fill the logs with lots of errors return try: diff --git a/common/djangoapps/student/tests/test_auto_auth.py b/common/djangoapps/student/tests/test_auto_auth.py index f9c4ae63deb61d3920bdfb2f1ffff4b5191bc676..10936cff3f7e19e72fff989658dccdabfc4328b1 100644 --- a/common/djangoapps/student/tests/test_auto_auth.py +++ b/common/djangoapps/student/tests/test_auto_auth.py @@ -11,9 +11,9 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase): Tests for the Auto auth view that we have for load testing. """ - @patch.dict("django.conf.settings.MITX_FEATURES", {"AUTOMATIC_AUTH_FOR_TESTING": True}) + @patch.dict("django.conf.settings.FEATURES", {"AUTOMATIC_AUTH_FOR_TESTING": True}) def setUp(self): - # Patching the settings.MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] + # Patching the settings.FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] # value affects the contents of urls.py, # so we need to call super.setUp() which reloads urls.py (because # of the UrlResetMixin) @@ -78,7 +78,7 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase): self.assertEqual(user1.email, 'USER_1_dummy_test@mitx.mit.edu') self.assertEqual(qset[1].username, 'USER_2') - @patch.dict("django.conf.settings.MITX_FEATURES", {"MAX_AUTO_AUTH_USERS": 1}) + @patch.dict("django.conf.settings.FEATURES", {"MAX_AUTO_AUTH_USERS": 1}) def test_login_already_created_user(self): """ Test that when we have reached the limit for automatic users @@ -102,9 +102,9 @@ class AutoAuthDisabledTestCase(UrlResetMixin, TestCase): Test that the page is inaccessible with default settings """ - @patch.dict("django.conf.settings.MITX_FEATURES", {"AUTOMATIC_AUTH_FOR_TESTING": False}) + @patch.dict("django.conf.settings.FEATURES", {"AUTOMATIC_AUTH_FOR_TESTING": False}) def setUp(self): - # Patching the settings.MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] + # Patching the settings.FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] # value affects the contents of urls.py, # so we need to call super.setUp() which reloads urls.py (because # of the UrlResetMixin) diff --git a/common/djangoapps/student/tests/test_bulk_email_settings.py b/common/djangoapps/student/tests/test_bulk_email_settings.py index 98fddeaddd76df3d37cbef6f3cb6150e1252e618..6b903d9979058b7d47a97f0fa47e06f1e14e1af6 100644 --- a/common/djangoapps/student/tests/test_bulk_email_settings.py +++ b/common/djangoapps/student/tests/test_bulk_email_settings.py @@ -56,19 +56,19 @@ class TestStudentDashboardEmailView(ModuleStoreTestCase): """ patch.stopall() - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_true(self): # Assert that the URL for the email view is in the response response = self.client.get(self.url) self.assertTrue(self.email_modal_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) def test_email_flag_false(self): # Assert that the URL for the email view is not in the response response = self.client.get(self.url) self.assertFalse(self.email_modal_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_email_unauthorized(self): # Assert that instructor email is not enabled for this course self.assertFalse(CourseAuthorization.instructor_email_enabled(self.course.id)) @@ -77,7 +77,7 @@ class TestStudentDashboardEmailView(ModuleStoreTestCase): response = self.client.get(self.url) self.assertFalse(self.email_modal_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_email_authorized(self): # Authorize the course to use email cauth = CourseAuthorization(course_id=self.course.id, email_enabled=True) @@ -120,14 +120,14 @@ class TestStudentDashboardEmailViewXMLBacked(ModuleStoreTestCase): ) ) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_true_xml_store(self): # The flag is enabled, and since REQUIRE_COURSE_EMAIL_AUTH is False, all courses should # be authorized to use email. But the course is not Mongo-backed (should not work) response = self.client.get(self.url) self.assertFalse(self.email_modal_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_false_xml_store(self): # Email disabled, shouldn't see link. response = self.client.get(self.url) diff --git a/common/djangoapps/student/tests/test_login.py b/common/djangoapps/student/tests/test_login.py index 6bc909affec08056d4e5494f25dca4f2510d9951..6593412cf466eab116f9a3a082ecd2724bfeda5f 100644 --- a/common/djangoapps/student/tests/test_login.py +++ b/common/djangoapps/student/tests/test_login.py @@ -216,7 +216,7 @@ class ExternalAuthShibTest(ModuleStoreTestCase): self.user_wo_map = UserFactory.create(email='womap@gmail.com') self.user_wo_map.save() - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_login_page_redirect(self): """ Tests that when a shib user types their email address into the login page, they get redirected @@ -226,7 +226,7 @@ class ExternalAuthShibTest(ModuleStoreTestCase): self.assertEqual(response.status_code, 200) self.assertEqual(response.content, json.dumps({'success': False, 'redirect': reverse('shib-login')})) - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test__get_course_enrollment_domain(self): """ Tests the _get_course_enrollment_domain utility function @@ -235,7 +235,7 @@ class ExternalAuthShibTest(ModuleStoreTestCase): self.assertIsNone(_get_course_enrollment_domain(self.course.id)) self.assertEqual(self.shib_course.enrollment_domain, _get_course_enrollment_domain(self.shib_course.id)) - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_login_required_dashboard(self): """ Tests redirects to when @login_required to dashboard, which should always be the normal login, @@ -245,7 +245,7 @@ class ExternalAuthShibTest(ModuleStoreTestCase): self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], 'http://testserver/accounts/login?next=/dashboard') - @unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") + @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") def test_externalauth_login_required_course_context(self): """ Tests the redirects when visiting course-specific URL with @login_required. diff --git a/common/djangoapps/student/tests/tests.py b/common/djangoapps/student/tests/tests.py index 41d916520f7477254799a305c35ac73d317f55a3..f2a9593123ffc6a0acaebe2a73b3a4e733ec4c2e 100644 --- a/common/djangoapps/student/tests/tests.py +++ b/common/djangoapps/student/tests/tests.py @@ -82,7 +82,7 @@ class ResetPasswordTests(TestCase): self.assertEquals(bad_email_resp.content, json.dumps({'success': True, 'value': "('registration/password_reset_done.html', [])"})) - @unittest.skipUnless(not settings.MITX_FEATURES.get('DISABLE_PASSWORD_RESET_EMAIL_TEST', False), + @unittest.skipUnless(not settings.FEATURES.get('DISABLE_PASSWORD_RESET_EMAIL_TEST', False), dedent("""Skipping Test because CMS has not provided necessary templates for password reset. If LMS tests print this message, that needs to be fixed.""")) @patch('django.core.mail.send_mail') @@ -512,7 +512,7 @@ class PaidRegistrationTest(ModuleStoreTestCase): self.assertIsNotNone(self.course) self.user = User.objects.create(username="jack", email="jack@fake.edx.org") - @unittest.skipUnless(settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART'), "Shopping Cart not enabled in settings") + @unittest.skipUnless(settings.FEATURES.get('ENABLE_SHOPPING_CART'), "Shopping Cart not enabled in settings") def test_change_enrollment_add_to_cart(self): request = self.req_factory.post(reverse('change_enrollment'), {'course_id': self.course.id, 'enrollment_action': 'add_to_cart'}) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 28c4e4f5fd4da9e9faf1e496dbcafc5176037585..96ccba46e68801c498afcc01daa94c26959114cd 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -100,7 +100,7 @@ def index(request, extra_context={}, user=None): """ # The course selection work is done in courseware.courses. - domain = settings.MITX_FEATURES.get('FORCE_UNIVERSITY_DOMAIN') # normally False + domain = settings.FEATURES.get('FORCE_UNIVERSITY_DOMAIN') # normally False # do explicit check, because domain=None is valid if domain is False: domain = request.META.get('HTTP_HOST') @@ -331,7 +331,7 @@ def dashboard(request): # only show email settings for Mongo course and when bulk email is turned on show_email_settings_for = frozenset( course.id for course, _enrollment in course_enrollment_pairs if ( - settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and + settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and modulestore().get_modulestore_type(course.id) == MONGO_MODULESTORE_TYPE and CourseAuthorization.instructor_email_enabled(course.id) ) @@ -516,7 +516,7 @@ def accounts_login(request): This view is mainly used as the redirect from the @login_required decorator. I don't believe that the login path linked from the homepage uses it. """ - if settings.MITX_FEATURES.get('AUTH_USE_CAS'): + if settings.FEATURES.get('AUTH_USE_CAS'): return redirect(reverse('cas-login')) # see if the "next" parameter has been set, whether it has a course context, and if so, whether # there is a course-specific place to redirect @@ -547,7 +547,7 @@ def login_user(request, error=""): # check if the user has a linked shibboleth account, if so, redirect the user to shib-login # This behavior is pretty much like what gmail does for shibboleth. Try entering some @stanford.edu # address into the Gmail login. - if settings.MITX_FEATURES.get('AUTH_USE_SHIB') and user: + if settings.FEATURES.get('AUTH_USE_SHIB') and user: try: eamap = ExternalAuthMap.objects.get(user=user) if eamap.external_domain.startswith(external_auth.views.SHIBBOLETH_DOMAIN_PREFIX): @@ -634,7 +634,7 @@ def logout_user(request): # We do not log here, because we have a handler registered # to perform logging on successful logouts. logout(request) - if settings.MITX_FEATURES.get('AUTH_USE_CAS'): + if settings.FEATURES.get('AUTH_USE_CAS'): target = reverse('cas-logout') else: target = '/' @@ -832,8 +832,8 @@ def create_account(request, post_override=None): return HttpResponse(json.dumps(js)) # Can't have terms of service for certain SHIB users, like at Stanford - tos_not_required = (settings.MITX_FEATURES.get("AUTH_USE_SHIB") and - settings.MITX_FEATURES.get('SHIB_DISABLE_TOS') and + tos_not_required = (settings.FEATURES.get("AUTH_USE_SHIB") and + settings.FEATURES.get('SHIB_DISABLE_TOS') and DoExternalAuth and eamap.external_domain.startswith(external_auth.views.SHIBBOLETH_DOMAIN_PREFIX)) @@ -896,10 +896,10 @@ def create_account(request, post_override=None): message = render_to_string('emails/activation_email.txt', d) # don't send email if we are doing load testing or random user generation for some reason - if not (settings.MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING')): + if not (settings.FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING')): try: - if settings.MITX_FEATURES.get('REROUTE_ACTIVATION_EMAIL'): - dest_addr = settings.MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] + if settings.FEATURES.get('REROUTE_ACTIVATION_EMAIL'): + dest_addr = settings.FEATURES['REROUTE_ACTIVATION_EMAIL'] message = ("Activation for %s (%s): %s\n" % (user, user.email, profile.name) + '-' * 80 + '\n\n' + message) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [dest_addr], fail_silently=False) @@ -929,7 +929,7 @@ def create_account(request, post_override=None): AUDIT_LOG.info("User registered with external_auth %s", post_vars['username']) AUDIT_LOG.info('Updated ExternalAuthMap for %s to be %s', post_vars['username'], eamap) - if settings.MITX_FEATURES.get('BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH'): + if settings.FEATURES.get('BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH'): log.info('bypassing activation email') login_user.is_active = True login_user.save() @@ -969,7 +969,7 @@ def auto_auth(request): """ Automatically logs the user in with a generated random credentials This view is only accessible when - settings.MITX_SETTINGS['AUTOMATIC_AUTH_FOR_TESTING'] is true. + settings.FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] is true. """ def get_dummy_post_data(username, password, email, name): @@ -988,7 +988,7 @@ def auto_auth(request): name_base = 'USER_' pass_base = 'PASS_' - max_users = settings.MITX_FEATURES.get('MAX_AUTO_AUTH_USERS', 200) + max_users = settings.FEATURES.get('MAX_AUTO_AUTH_USERS', 200) number = random.randint(1, max_users) # Get the params from the request to override default user attributes if specified diff --git a/common/djangoapps/track/tests.py b/common/djangoapps/track/tests.py index 2cf7b0f3ab9038b877042b5e48e15626b4361cc6..efc68a7267bde9be642f60bcae48bb24f824e1ab 100644 --- a/common/djangoapps/track/tests.py +++ b/common/djangoapps/track/tests.py @@ -22,7 +22,7 @@ class TrackingTest(TestCase): {"event": "my_event", "event_type": "my_event_type", "page": "my_page"}, {"event": "{'json': 'object'}", "event_type": unichr(512), "page": "my_page"} ] - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): for request_params in requests: try: # because /event maps to two different views in lms and cms, we're only going to test lms here response = self.client.post(reverse(user_track), request_params) @@ -45,7 +45,7 @@ class TrackingTest(TestCase): {"event": "my_event", "event_type": "my_event_type", "page": "my_page"}, {"event": "{'json': 'object'}", "event_type": unichr(512), "page": "my_page"} ] - with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): + with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_SQL_TRACKING_LOGS': True}): for request_params in requests: try: # because /event maps to two different views in lms and cms, we're only going to test lms here response = self.client.get(reverse(user_track), request_params) diff --git a/common/djangoapps/util/tests/test_submit_feedback.py b/common/djangoapps/util/tests/test_submit_feedback.py index 6461ffa8b781f8c1f13b9756c9015a1cdd1800e8..e1772fc7e1b357802a8c17318454b818b5bcec33 100644 --- a/common/djangoapps/util/tests/test_submit_feedback.py +++ b/common/djangoapps/util/tests/test_submit_feedback.py @@ -12,7 +12,7 @@ import json import mock -@mock.patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_FEEDBACK_SUBMISSION": True}) +@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_FEEDBACK_SUBMISSION": True}) @override_settings(ZENDESK_URL="dummy", ZENDESK_USER="dummy", ZENDESK_API_KEY="dummy") @mock.patch("util.views.dog_stats_api") @mock.patch("util.views._ZendeskApi", autospec=True) @@ -282,7 +282,7 @@ class SubmitFeedbackTest(TestCase): self.assertEqual(resp.status_code, 200) self._assert_datadog_called(datadog_mock, with_tags=True) - @mock.patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_FEEDBACK_SUBMISSION": False}) + @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_FEEDBACK_SUBMISSION": False}) def test_not_enabled(self, zendesk_mock_class, datadog_mock): """ Test for Zendesk submission not enabled in `settings`. diff --git a/common/djangoapps/util/views.py b/common/djangoapps/util/views.py index b08c719baa501bb414fe88df8a141f9bfa850e65..892ac56a02e6799d11601fbf28b10d98f580f1b1 100644 --- a/common/djangoapps/util/views.py +++ b/common/djangoapps/util/views.py @@ -151,7 +151,7 @@ def submit_feedback(request): will be returned with no body; if ticket creation succeeds, an empty successful response (200) will be returned. """ - if not settings.MITX_FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): + if not settings.FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): raise Http404() if request.method != "POST": return HttpResponseNotAllowed(["POST"]) diff --git a/common/djangoapps/xmodule_modifiers.py b/common/djangoapps/xmodule_modifiers.py index d46065d5a7654f26f269522044bb8311895dc819..c03ddfd69544e0dded99fe3e3822842f93909eb6 100644 --- a/common/djangoapps/xmodule_modifiers.py +++ b/common/djangoapps/xmodule_modifiers.py @@ -163,7 +163,7 @@ def add_histogram(user, block, view, frag, context): # pylint: disable=unused-a histogram = None render_histogram = False - if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'): + if settings.FEATURES.get('ENABLE_LMS_MIGRATION'): [filepath, filename] = getattr(block, 'xml_attributes', {}).get('filename', ['', None]) osfs = block.system.filestore if filename is not None and osfs.exists(filename): @@ -201,7 +201,7 @@ def add_histogram(user, block, view, frag, context): # pylint: disable=unused-a 'element_id': block.location.html_id().replace('-', '_'), 'edit_link': edit_link, 'user': user, - 'xqa_server': settings.MITX_FEATURES.get('USE_XQA_SERVER', 'http://xqa:server@content-qa.mitx.mit.edu/xqa'), + 'xqa_server': settings.FEATURES.get('USE_XQA_SERVER', 'http://xqa:server@content-qa.mitx.mit.edu/xqa'), 'histogram': json.dumps(histogram), 'render_histogram': render_histogram, 'block_content': frag.content, diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index e95b387088002759123e98494430e0ff3f2145d6..b7ca37b16eee66f98b82ac800feedc83a2ab2c5c 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -187,7 +187,7 @@ class VideoModule(VideoFields, XModule): 'show_captions': json.dumps(self.show_captions), 'start': self.start_time.total_seconds(), 'end': self.end_time.total_seconds(), - 'autoplay': settings.MITX_FEATURES.get('AUTOPLAY_VIDEOS', False), + 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False), # TODO: Later on the value 1500 should be taken from some global # configuration setting field. 'yt_test_timeout': 1500, diff --git a/docs/internal/development.md b/docs/internal/development.md index 5b0e606adbe9bc871362d671d44fff11b3db5a29..1ce44a938e87d380dcc415db5275be41664d6cf4 100644 --- a/docs/internal/development.md +++ b/docs/internal/development.md @@ -116,5 +116,5 @@ course content can be setup to trigger an automatic reload when changes are push Note that the gitreload-based workflow is not meant for deployments on AWS (or elsewhere) which use collectstatic, since collectstatic is not run by a gitreload event. -Also, the gitreload feature needs MITX_FEATURES['ENABLE_LMS_MIGRATION'] = True in the django settings. +Also, the gitreload feature needs FEATURES['ENABLE_LMS_MIGRATION'] = True in the django settings. diff --git a/docs/internal/remote_gradebook.md b/docs/internal/remote_gradebook.md index 3743e987531edc25dc953ee0ed247767fc45c335..644105a76d02cff6ccedeaafb3a4922f23e6c0a9 100644 --- a/docs/internal/remote_gradebook.md +++ b/docs/internal/remote_gradebook.md @@ -10,7 +10,7 @@ An "xserver" is a web-based server that is part of the MITx eco system. There a The remote gradebook xserver should be specified in the lms.envs configuration using - MITX_FEATURES[REMOTE_GRADEBOOK_URL] + FEATURES[REMOTE_GRADEBOOK_URL] Each course, in addition, should define the name of the gradebook being used. A class "section" may also be specified. This goes in the policy.json file, eg: diff --git a/lms/djangoapps/branding/__init__.py b/lms/djangoapps/branding/__init__.py index aae57ac2e9ebef52884861220a5475f2cf76acbd..d70ffb1cc99098ab9746bd2ab8e479dc2091bbc9 100644 --- a/lms/djangoapps/branding/__init__.py +++ b/lms/djangoapps/branding/__init__.py @@ -20,7 +20,7 @@ def get_visible_courses(domain=None): if isinstance(c, CourseDescriptor)] courses = sorted(courses, key=lambda course: course.number) - if domain and settings.MITX_FEATURES.get('SUBDOMAIN_COURSE_LISTINGS'): + if domain and settings.FEATURES.get('SUBDOMAIN_COURSE_LISTINGS'): subdomain = pick_subdomain(domain, settings.COURSE_LISTINGS.keys()) visible_ids = frozenset(settings.COURSE_LISTINGS[subdomain]) return [course for course in courses if course.id in visible_ids] @@ -33,7 +33,7 @@ def get_university(domain=None): Return the university name specified for the domain, or None if no university was specified """ - if not settings.MITX_FEATURES['SUBDOMAIN_BRANDING'] or domain is None: + if not settings.FEATURES['SUBDOMAIN_BRANDING'] or domain is None: return None subdomain = pick_subdomain(domain, settings.SUBDOMAIN_BRANDING.keys()) diff --git a/lms/djangoapps/branding/tests.py b/lms/djangoapps/branding/tests.py index 3d900e3ec31f99ed094242b207b60a8724335b63..e880ccb62d7ab016e3135394f5fc163055bcc469 100644 --- a/lms/djangoapps/branding/tests.py +++ b/lms/djangoapps/branding/tests.py @@ -12,10 +12,10 @@ from xmodule.modulestore.tests.factories import CourseFactory from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE import student.views -MITX_FEATURES_WITH_STARTDATE = settings.MITX_FEATURES.copy() -MITX_FEATURES_WITH_STARTDATE['DISABLE_START_DATES'] = False -MITX_FEATURES_WO_STARTDATE = settings.MITX_FEATURES.copy() -MITX_FEATURES_WO_STARTDATE['DISABLE_START_DATES'] = True +FEATURES_WITH_STARTDATE = settings.FEATURES.copy() +FEATURES_WITH_STARTDATE['DISABLE_START_DATES'] = False +FEATURES_WO_STARTDATE = settings.FEATURES.copy() +FEATURES_WO_STARTDATE['DISABLE_START_DATES'] = True @override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE) @@ -31,7 +31,7 @@ class AnonymousIndexPageTest(ModuleStoreTestCase): self.course.enrollment_start = datetime.datetime.now(UTC) + datetime.timedelta(days=3) self.store.save_xmodule(self.course) - @override_settings(MITX_FEATURES=MITX_FEATURES_WITH_STARTDATE) + @override_settings(FEATURES=FEATURES_WITH_STARTDATE) def test_none_user_index_access_with_startdate_fails(self): """ This was a "before" test for a bugfix. If someone fixes the bug another way in the future @@ -40,12 +40,12 @@ class AnonymousIndexPageTest(ModuleStoreTestCase): with self.assertRaisesRegexp(AttributeError, "'NoneType' object has no attribute 'is_authenticated'"): student.views.index(self.factory.get('/'), user=None) # pylint: disable=E1101 - @override_settings(MITX_FEATURES=MITX_FEATURES_WITH_STARTDATE) + @override_settings(FEATURES=FEATURES_WITH_STARTDATE) def test_anon_user_with_startdate_index(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) - @override_settings(MITX_FEATURES=MITX_FEATURES_WO_STARTDATE) + @override_settings(FEATURES=FEATURES_WO_STARTDATE) def test_anon_user_no_startdate_index(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py index 215d442de547ff3a11b7a9b2b7e9baf628cc657d..b725f7e1996a0a7b1a5abf88b85ead79913ebf66 100644 --- a/lms/djangoapps/branding/views.py +++ b/lms/djangoapps/branding/views.py @@ -22,10 +22,10 @@ def index(request): if settings.COURSEWARE_ENABLED and request.user.is_authenticated(): return redirect(reverse('dashboard')) - if settings.MITX_FEATURES.get('AUTH_USE_MIT_CERTIFICATES'): + if settings.FEATURES.get('AUTH_USE_MIT_CERTIFICATES'): from external_auth.views import ssl_login return ssl_login(request) - if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE'): + if settings.FEATURES.get('ENABLE_MKTG_SITE'): return redirect(settings.MKTG_URLS.get('ROOT')) university = branding.get_university(request.META.get('HTTP_HOST')) @@ -46,10 +46,10 @@ def courses(request): to that. Otherwise, if subdomain branding is on, this is the university profile page. Otherwise, it's the edX courseware.views.courses page """ - if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False): + if settings.FEATURES.get('ENABLE_MKTG_SITE', False): return redirect(marketing_link('COURSES'), permanent=True) - if not settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'): + if not settings.FEATURES.get('COURSES_ARE_BROWSABLE'): raise Http404 # we do not expect this case to be reached in cases where diff --git a/lms/djangoapps/bulk_email/models.py b/lms/djangoapps/bulk_email/models.py index 83a691f18e3c9be4125ec3cf635c55d5c80ac7c5..4eceff13d993488d4de1c8bcc9150b42267fe650 100644 --- a/lms/djangoapps/bulk_email/models.py +++ b/lms/djangoapps/bulk_email/models.py @@ -231,9 +231,9 @@ class CourseAuthorization(models.Model): If email has not been explicitly enabled, returns False. """ - # If settings.MITX_FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] is + # If settings.FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] is # set to False, then we enable email for every course. - if not settings.MITX_FEATURES['REQUIRE_COURSE_EMAIL_AUTH']: + if not settings.FEATURES['REQUIRE_COURSE_EMAIL_AUTH']: return True try: diff --git a/lms/djangoapps/bulk_email/tests/test_course_optout.py b/lms/djangoapps/bulk_email/tests/test_course_optout.py index 378610eeb369929d2dbe3243d1bacdd742054488..086d51b87a58dfba229a35f00f444f2474dc63c9 100644 --- a/lms/djangoapps/bulk_email/tests/test_course_optout.py +++ b/lms/djangoapps/bulk_email/tests/test_course_optout.py @@ -59,7 +59,7 @@ class TestOptoutCourseEmails(ModuleStoreTestCase): selected_email_link = '<a href="#" onclick="goto(\'Email\')" class="selectedmode">Email</a>' self.assertTrue(selected_email_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_optout_course(self): """ Make sure student does not receive course email after opting out. @@ -88,7 +88,7 @@ class TestOptoutCourseEmails(ModuleStoreTestCase): # Assert that self.student.email not in mail.to, outbox should be empty self.assertEqual(len(mail.outbox), 0) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_optin_course(self): """ Make sure student receives course email after opting in. diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index 4bb7299f5b73bb42fe0aa4915366be58b8214649..952d017283e1a03c1362f294efe023eadd964671 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -46,7 +46,7 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase): Test that emails send correctly. """ - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def setUp(self): self.course = CourseFactory.create() diff --git a/lms/djangoapps/bulk_email/tests/test_forms.py b/lms/djangoapps/bulk_email/tests/test_forms.py index 60a8abf95e1c4e04ccb1a2acd9c992ad68c980c1..0b86344379981c760ad1281218a6ef2a460a88f6 100644 --- a/lms/djangoapps/bulk_email/tests/test_forms.py +++ b/lms/djangoapps/bulk_email/tests/test_forms.py @@ -32,7 +32,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase): """ patch.stopall() - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_authorize_mongo_course(self): # Initially course shouldn't be authorized self.assertFalse(CourseAuthorization.instructor_email_enabled(self.course.id)) @@ -45,7 +45,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase): # Check that this course is authorized self.assertTrue(CourseAuthorization.instructor_email_enabled(self.course.id)) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_form_typo(self): # Munge course id bad_id = self.course.id + '_typo' @@ -63,7 +63,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase): with self.assertRaisesRegexp(ValueError, "The CourseAuthorization could not be created because the data didn't validate."): form.save() - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_course_name_only(self): # Munge course id - common bad_id = self.course.id.split('/')[-1] @@ -86,7 +86,7 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase): class CourseAuthorizationXMLFormTest(ModuleStoreTestCase): """Check that XML courses cannot be authorized for email.""" - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_xml_course_authorization(self): course_id = 'edX/toy/2012_Fall' # Assert this is an XML course diff --git a/lms/djangoapps/bulk_email/tests/test_models.py b/lms/djangoapps/bulk_email/tests/test_models.py index 30713e178c57d93dccb510fb1867f9ab824c8bb1..f812972fc6e2324f9b845b225fbe3e14257f64b2 100644 --- a/lms/djangoapps/bulk_email/tests/test_models.py +++ b/lms/djangoapps/bulk_email/tests/test_models.py @@ -107,7 +107,7 @@ class CourseEmailTemplateTest(TestCase): class CourseAuthorizationTest(TestCase): """Test the CourseAuthorization model.""" - @patch.dict(settings.MITX_FEATURES, {'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_creation_auth_on(self): course_id = 'abc/123/doremi' # Test that course is not authorized by default @@ -133,7 +133,7 @@ class CourseAuthorizationTest(TestCase): "Course 'abc/123/doremi': Instructor Email Not Enabled" ) - @patch.dict(settings.MITX_FEATURES, {'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_creation_auth_off(self): course_id = 'blahx/blah101/ehhhhhhh' # Test that course is authorized by default, since auth is turned off diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index 8c4fb662f931f530eebd62195f52860c6aaeb0d8..9c456afc2f5b9ae8be9c7c9024b8f0197860678d 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -134,7 +134,7 @@ def _has_access_course_desc(user, course, action): (staff can always enroll) """ # if using registration method to restrict (say shibboleth) - if settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: + if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: if user is not None and user.is_authenticated() and \ ExternalAuthMap.objects.filter(user=user, external_domain=course.enrollment_domain): debug("Allow: external_auth of " + course.enrollment_domain) @@ -173,7 +173,7 @@ def _has_access_course_desc(user, course, action): # VS[compat] -- this setting should go away once all courses have # properly configured enrollment_start times (if course should be # staff-only, set enrollment_start far in the future.) - if settings.MITX_FEATURES.get('ACCESS_REQUIRE_STAFF_FOR_COURSE'): + if settings.FEATURES.get('ACCESS_REQUIRE_STAFF_FOR_COURSE'): # if this feature is on, only allow courses that have ispublic set to be # seen by non-staff if course.ispublic: @@ -234,7 +234,7 @@ def _has_access_descriptor(user, descriptor, action, course_context=None): don't have to hit the enrollments table on every module load. """ # If start dates are off, can always load - if settings.MITX_FEATURES['DISABLE_START_DATES'] and not is_masquerading_as_student(user): + if settings.FEATURES['DISABLE_START_DATES'] and not is_masquerading_as_student(user): debug("Allow: DISABLE_START_DATES") return True @@ -361,7 +361,7 @@ def _adjust_start_date_for_beta_testers(user, descriptor, course_context=None): the user is looking at. Once we have proper usages and definitions per the XBlock design, this should use the course the usage is in. - NOTE: If testing manually, make sure MITX_FEATURES['DISABLE_START_DATES'] = False + NOTE: If testing manually, make sure FEATURES['DISABLE_START_DATES'] = False in envs/dev.py! """ if descriptor.days_early_for_beta is None: diff --git a/lms/djangoapps/courseware/masquerade.py b/lms/djangoapps/courseware/masquerade.py index 27135f727e77312bee95b46a47dc5245374d2e02..a044e89d91e4d24af009c3e2620032a355d7dff8 100644 --- a/lms/djangoapps/courseware/masquerade.py +++ b/lms/djangoapps/courseware/masquerade.py @@ -40,7 +40,7 @@ def setup_masquerade(request, staff_access=False): if request.user is None: return None - if not settings.MITX_FEATURES.get('ENABLE_MASQUERADE', False): + if not settings.FEATURES.get('ENABLE_MASQUERADE', False): return None if not staff_access: # can masquerade only if user has staff access to course diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 436e9ee54af480eec5da5925343e5d645a397ac1..92d4ad7f02c72c8039eded3d2ea9c65e3895f420 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -363,7 +363,7 @@ def get_module_for_descriptor_internal(user, descriptor, field_data_cache, cours reverse('jump_to_id', kwargs={'course_id': course_id, 'module_id': ''}), )) - if settings.MITX_FEATURES.get('DISPLAY_HISTOGRAMS_TO_STAFF'): + if settings.FEATURES.get('DISPLAY_HISTOGRAMS_TO_STAFF'): if has_access(user, descriptor, 'staff', course_id): block_wrappers.append(partial(add_histogram, user)) @@ -423,7 +423,7 @@ def get_module_for_descriptor_internal(user, descriptor, field_data_cache, cours # pass position specified in URL to module through ModuleSystem system.set('position', position) - if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS'): + if settings.FEATURES.get('ENABLE_PSYCHOMETRICS'): system.set( 'psychometrics_handler', # set callback for updating PsychometricsData make_psychometrics_data_update_handler(course_id, user, descriptor.location.url()) diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 7ee16adcfb2890a485a09fcf24b469924af7e3cf..7bc1c0473fb35993ad3778ec0f74f636c1c8a6a4 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -100,7 +100,7 @@ def _discussion(tab, user, course, active_page, request): """ This tab format only supports the new Berkeley discussion forums. """ - if settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'): + if settings.FEATURES.get('ENABLE_DISCUSSION_SERVICE'): link = reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id]) return [CourseTab(tab['name'], link, active_page == 'discussion')] @@ -129,7 +129,7 @@ def _textbooks(tab, user, course, active_page, request): """ Generates one tab per textbook. Only displays if user is authenticated. """ - if user.is_authenticated() and settings.MITX_FEATURES.get('ENABLE_TEXTBOOK'): + if user.is_authenticated() and settings.FEATURES.get('ENABLE_TEXTBOOK'): # since there can be more than one textbook, active_page is e.g. "book/0". return [CourseTab(textbook.title, reverse('book', args=[course.id, index]), active_page == "textbook/{0}".format(index)) @@ -211,7 +211,7 @@ def _combined_open_ended_grading(tab, user, course, active_page, request): def _notes_tab(tab, user, course, active_page, request): - if user.is_authenticated() and settings.MITX_FEATURES.get('ENABLE_STUDENT_NOTES'): + if user.is_authenticated() and settings.FEATURES.get('ENABLE_STUDENT_NOTES'): link = reverse('notes', args=[course.id]) return [CourseTab(tab['name'], link, active_page == 'notes')] return [] @@ -349,7 +349,7 @@ def get_discussion_link(course): """ if course.discussion_link: return course.discussion_link - elif not settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'): + elif not settings.FEATURES.get('ENABLE_DISCUSSION_SERVICE'): return None elif hasattr(course, 'tabs') and course.tabs and not any([tab['type'] == 'discussion' for tab in course.tabs]): return None diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index 4274ebf85d92a159f2480686adc5be1be3648e6a..e1c15d0df7a5210d16667e827648d96aebd904ba 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -166,7 +166,7 @@ class TextbooksTestCase(TestCase): self.textbook_1 = 'textbook/1' self.prohibited_page = 'you_shouldnt_be_seein_this' - @override_settings(MITX_FEATURES={'ENABLE_TEXTBOOK': True}) + @override_settings(FEATURES={'ENABLE_TEXTBOOK': True}) def test_textbooks1(self): tab_list = tab_constructor( @@ -211,7 +211,7 @@ class TextbooksTestCase(TestCase): ) self.assertEqual(tab_list[1].is_active, False) - @override_settings(MITX_FEATURES={'ENABLE_TEXTBOOK': False}) + @override_settings(FEATURES={'ENABLE_TEXTBOOK': False}) def test_textbooks0(self): tab_list = tab_constructor( @@ -304,34 +304,34 @@ class DiscussionLinkTestCase(ModuleStoreTestCase): return None return patch("courseware.tabs.reverse", patched_reverse) - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": False}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": False}) def test_explicit_discussion_link(self): """Test that setting discussion_link overrides everything else""" course = CourseFactory.create(discussion_link="other_discussion_link", tabs=self.tabs_with_discussion) self.assertEqual(tabs.get_discussion_link(course), "other_discussion_link") - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": False}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": False}) def test_discussions_disabled(self): """Test that other cases return None with discussions disabled""" for i, t in enumerate([None, self.tabs_with_discussion, self.tabs_without_discussion]): course = CourseFactory.create(tabs=t, number=str(i)) self.assertEqual(tabs.get_discussion_link(course), None) - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def test_no_tabs(self): """Test a course without tabs configured""" course = CourseFactory.create(tabs=None) with self._patch_reverse(course): self.assertEqual(tabs.get_discussion_link(course), "default_discussion_link") - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def test_tabs_with_discussion(self): """Test a course with a discussion tab configured""" course = CourseFactory.create(tabs=self.tabs_with_discussion) with self._patch_reverse(course): self.assertEqual(tabs.get_discussion_link(course), "default_discussion_link") - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def test_tabs_without_discussion(self): """Test a course with tabs configured but without a discussion tab""" course = CourseFactory.create(tabs=self.tabs_without_discussion) diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index d364dc6fe53a5abba14136a6a4bf9f14ce5ae6c8..e3c4ea5bd11030d1713008e49e214166f4b1411f 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -53,7 +53,7 @@ class TestVideo(BaseTestXmodule): 'sub': u'a_sub_file.srt.sjson', 'track': '', 'youtube_streams': _create_youtube_string(self.item_module), - 'autoplay': settings.MITX_FEATURES.get('AUTOPLAY_VIDEOS', False), + 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False), 'yt_test_timeout': 1500, 'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/' } @@ -107,7 +107,7 @@ class TestVideoNonYouTube(TestVideo): 'sub': u'a_sub_file.srt.sjson', 'track': '', 'youtube_streams': '1.00:OEoXaMPEzfM', - 'autoplay': settings.MITX_FEATURES.get('AUTOPLAY_VIDEOS', True), + 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), 'yt_test_timeout': 1500, 'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/' } diff --git a/lms/djangoapps/courseware/tests/test_video_xml.py b/lms/djangoapps/courseware/tests/test_video_xml.py index cf202db212659331b9f4abf157e67bf1831f5827..87e430c6b0cfc634641b7a2b06d0f192c6f5844e 100644 --- a/lms/djangoapps/courseware/tests/test_video_xml.py +++ b/lms/djangoapps/courseware/tests/test_video_xml.py @@ -88,7 +88,7 @@ class VideoModuleUnitTest(unittest.TestCase): 'sources': sources, 'youtube_streams': _create_youtube_string(module), 'track': '', - 'autoplay': settings.MITX_FEATURES.get('AUTOPLAY_VIDEOS', False), + 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False), 'yt_test_timeout': 1500, 'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/' } diff --git a/lms/djangoapps/courseware/tests/test_view_authentication.py b/lms/djangoapps/courseware/tests/test_view_authentication.py index 9ed0dea8e5d87e5be17b415b42e2369cf5c5181e..acb307e4650e6940a450966c4ca5185ef6c513b5 100644 --- a/lms/djangoapps/courseware/tests/test_view_authentication.py +++ b/lms/djangoapps/courseware/tests/test_view_authentication.py @@ -253,7 +253,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): for url in urls: check_for_get_code(self, 200, url) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_dark_launch_enrolled_student(self): """ Make sure that before course start, students can't access course @@ -280,7 +280,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): self._check_non_staff_light(self.test_course) self._check_non_staff_dark(self.test_course) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_dark_launch_instructor(self): """ Make sure that before course start instructors can access the @@ -303,7 +303,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): self._check_non_staff_dark(self.test_course) self._check_staff(self.course) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_dark_launch_global_staff(self): """ Make sure that before course start staff can access @@ -324,7 +324,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): self._check_staff(self.course) self._check_staff(self.test_course) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_enrollment_period(self): """ Check that enrollment periods work. @@ -371,7 +371,7 @@ class TestBetatesterAccess(ModuleStoreTestCase): self.normal_student = UserFactory() self.beta_tester = BetaTesterFactory(course=self.course.location) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_course_beta_period(self): """ Check that beta-test access works for courses. @@ -384,7 +384,7 @@ class TestBetatesterAccess(ModuleStoreTestCase): # now the student should see it self.assertTrue(has_access(self.beta_tester, self.course, 'load')) - @patch.dict('courseware.access.settings.MITX_FEATURES', {'DISABLE_START_DATES': False}) + @patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False}) def test_content_beta_period(self): """ Check that beta-test access works for content. diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index b1634a72ac0040b80e9fa4f6fb01bd1fa4ae6be7..91ec1e87c1ba314194d44ce2def518168a40701a 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -86,8 +86,8 @@ class ViewsTestCase(TestCase): chapter = 'Overview' self.chapter_url = '%s/%s/%s' % ('/courses', self.course_id, chapter) - @unittest.skipUnless(settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART'), "Shopping Cart not enabled in settings") - @patch.dict(settings.MITX_FEATURES, {'ENABLE_PAID_COURSE_REGISTRATION': True}) + @unittest.skipUnless(settings.FEATURES.get('ENABLE_SHOPPING_CART'), "Shopping Cart not enabled in settings") + @patch.dict(settings.FEATURES, {'ENABLE_PAID_COURSE_REGISTRATION': True}) def test_course_about_in_cart(self): in_cart_span = '<span class="add-to-cart">' # don't mock this course due to shopping cart existence checking diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 2ce1f545717ffba1f7eb947408217223b6ace34e..0608e2c75989d82fc8dd45616842016dc9edfd7e 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -263,12 +263,12 @@ def index(request, course_id, chapter=None, section=None, 'fragment': Fragment(), 'staff_access': staff_access, 'masquerade': masq, - 'xqa_server': settings.MITX_FEATURES.get('USE_XQA_SERVER', 'http://xqa:server@content-qa.mitx.mit.edu/xqa') + 'xqa_server': settings.FEATURES.get('USE_XQA_SERVER', 'http://xqa:server@content-qa.mitx.mit.edu/xqa') } # Only show the chat if it's enabled by the course and in the # settings. - show_chat = course.show_chat and settings.MITX_FEATURES['ENABLE_CHAT'] + show_chat = course.show_chat and settings.FEATURES['ENABLE_CHAT'] if show_chat: context['chat'] = chat_settings(course, user) # If we couldn't load the chat settings, then don't show @@ -514,7 +514,7 @@ def registered_for_course(course, user): @ensure_csrf_cookie @cache_if_anonymous def course_about(request, course_id): - if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False): + if settings.FEATURES.get('ENABLE_MKTG_SITE', False): raise Http404 course = get_course_with_access(request.user, course_id, 'see_exists') @@ -526,14 +526,14 @@ def course_about(request, course_id): course_target = reverse('about_course', args=[course.id]) show_courseware_link = (has_access(request.user, course, 'load') or - settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION')) + settings.FEATURES.get('ENABLE_LMS_MIGRATION')) # Note: this is a flow for payment for course registration, not the Verified Certificate flow. registration_price = 0 in_cart = False reg_then_add_to_cart_link = "" - if (settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART') and - settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION')): + if (settings.FEATURES.get('ENABLE_SHOPPING_CART') and + settings.FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION')): registration_price = CourseMode.min_course_price_for_currency(course_id, settings.PAID_COURSE_REGISTRATION_CURRENCY[0]) if request.user.is_authenticated(): @@ -579,7 +579,7 @@ def mktg_course_about(request, course_id): allow_registration = has_access(request.user, course, 'enroll') show_courseware_link = (has_access(request.user, course, 'load') or - settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION')) + settings.FEATURES.get('ENABLE_LMS_MIGRATION')) course_modes = CourseMode.modes_for_course(course.id) return render_to_response( diff --git a/lms/djangoapps/django_comment_client/base/tests.py b/lms/djangoapps/django_comment_client/base/tests.py index 8709d670ebeddcff6fd5ed987cc75a32d8c2a9ad..513780ecda3c48717d5a5a6e43b1ca3fa3bd4da5 100644 --- a/lms/djangoapps/django_comment_client/base/tests.py +++ b/lms/djangoapps/django_comment_client/base/tests.py @@ -21,7 +21,7 @@ log = logging.getLogger(__name__) @patch('lms.lib.comment_client.utils.requests.request') class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase): - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def setUp(self): # Patching the ENABLE_DISCUSSION_SERVICE value affects the contents of urls.py, diff --git a/lms/djangoapps/django_comment_client/forum/tests.py b/lms/djangoapps/django_comment_client/forum/tests.py index aac03d54ce12d550be0ba6430781b6f78e0bffdd..e8ebdb3e003853968cfd7307e6a4c525c9b66667 100644 --- a/lms/djangoapps/django_comment_client/forum/tests.py +++ b/lms/djangoapps/django_comment_client/forum/tests.py @@ -18,7 +18,7 @@ log = logging.getLogger(__name__) @override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE) class ViewsExceptionTestCase(UrlResetMixin, ModuleStoreTestCase): - @patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def setUp(self): # Patching the ENABLE_DISCUSSION_SERVICE value affects the contents of urls.py, diff --git a/lms/djangoapps/instructor/hint_manager.py b/lms/djangoapps/instructor/hint_manager.py index a8b97fbe32a9c1fb4803084805e7914c01f51c75..ab903e190944a89c773007e24a6e8cf2bc96cad9 100644 --- a/lms/djangoapps/instructor/hint_manager.py +++ b/lms/djangoapps/instructor/hint_manager.py @@ -4,7 +4,7 @@ Views for hint management. Get to these views through courseurl/hint_manager. For example: https://courses.edx.org/courses/MITx/2.01x/2013_Spring/hint_manager -These views will only be visible if MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True +These views will only be visible if FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True """ import json diff --git a/lms/djangoapps/instructor/tests/test_email.py b/lms/djangoapps/instructor/tests/test_email.py index f3b4194228e2de5b5199a6b3e7c49ad7e8e94e81..6a2b71f2e87de81a8f66279f9367630ba8dedb81 100644 --- a/lms/djangoapps/instructor/tests/test_email.py +++ b/lms/djangoapps/instructor/tests/test_email.py @@ -47,7 +47,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): # In order for bulk email to work, we must have both the ENABLE_INSTRUCTOR_EMAIL_FLAG # set to True and for the course to be Mongo-backed. # The flag is enabled and the course is Mongo-backed (should work) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_true_mongo_true(self): # Assert that instructor email is enabled for this course - since REQUIRE_COURSE_EMAIL_AUTH is False, # all courses should be authorized to use email. @@ -61,14 +61,14 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): self.assertEqual(response.status_code, 200) # The course is Mongo-backed but the flag is disabled (should not work) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) def test_email_flag_false_mongo_true(self): # Assert that the URL for the email view is not in the response response = self.client.get(self.url) self.assertFalse(self.email_link in response.content) # Flag is enabled, but we require course auth and haven't turned it on for this course - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_course_not_authorized(self): # Assert that instructor email is not enabled for this course self.assertFalse(CourseAuthorization.instructor_email_enabled(self.course.id)) @@ -77,7 +77,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): self.assertFalse(self.email_link in response.content) # Flag is enabled, we require course auth and turn it on for this course - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_course_authorized(self): # Assert that instructor email is not enabled for this course self.assertFalse(CourseAuthorization.instructor_email_enabled(self.course.id)) @@ -96,7 +96,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): self.assertTrue(self.email_link in response.content) # Flag is disabled, but course is authorized - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_course_authorized_feature_off(self): # Authorize the course to use email cauth = CourseAuthorization(course_id=self.course.id, email_enabled=True) @@ -128,13 +128,13 @@ class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase): # The flag is enabled, and since REQUIRE_COURSE_EMAIL_AUTH is False, all courses should # be authorized to use email. But the course is not Mongo-backed (should not work) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_true_mongo_false(self): response = self.client.get(self.url) self.assertFalse(self.email_link in response.content) # The flag is disabled and the course is not Mongo-backed (should not work) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_false_mongo_false(self): response = self.client.get(self.url) self.assertFalse(self.email_link in response.content) diff --git a/lms/djangoapps/instructor/tests/test_legacy_email.py b/lms/djangoapps/instructor/tests/test_legacy_email.py index 25a70e4f8a28205c91a727f9df54b4277a1018cd..c91d1cce2f22e3aef18e10cd6027553f29e86488 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_email.py +++ b/lms/djangoapps/instructor/tests/test_legacy_email.py @@ -42,7 +42,7 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase): """ patch.stopall() - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) def test_email_flag_true(self): # Assert that the URL for the email view is in the response response = self.client.get(self.url) @@ -60,14 +60,14 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase): send_to_label = '<label for="id_to">Send to:</label>' self.assertTrue(send_to_label in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_email_flag_unauthorized(self): # Assert that the URL for the email view is not in the response # email is enabled, but this course is not authorized to send email response = self.client.get(self.url) self.assertFalse(self.email_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True}) def test_email_flag_authorized(self): # Assert that the URL for the email view is in the response # email is enabled, and this course is authorized to send email @@ -86,13 +86,13 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase): response = self.client.get(self.url) self.assertTrue(self.email_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': False}) def test_email_flag_false(self): # Assert that the URL for the email view is not in the response response = self.client.get(self.url) self.assertFalse(self.email_link in response.content) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True}) + @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True}) def test_email_flag_true_xml_store(self): # If the enable email setting is enabled, but this is an XML backed course, # the email view shouldn't be available on the instructor dashboard. diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 9c1cc43a6146069315f26e88e154bb18d3f630ff..d170d09360e61a9cf6ce2df02fac3e410fbed03f 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -56,7 +56,7 @@ def instructor_dashboard_2(request, course_id): ] # Gate access to course email by feature flag & by course-specific authorization - if settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \ + if settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \ is_studio_course and CourseAuthorization.instructor_email_enabled(course_id): sections.append(_section_send_email(course_id, access, course)) @@ -66,7 +66,7 @@ def instructor_dashboard_2(request, course_id): enrollment_count = sections[0]['enrollment_count'] disable_buttons = False - max_enrollment_for_buttons = settings.MITX_FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") + max_enrollment_for_buttons = settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") if max_enrollment_for_buttons is not None: disable_buttons = enrollment_count > max_enrollment_for_buttons diff --git a/lms/djangoapps/instructor/views/legacy.py b/lms/djangoapps/instructor/views/legacy.py index 09046f7593811a4d78772547d6c034ff81b294a3..c33a3dc75e212c79f8764a3f741480369562060f 100644 --- a/lms/djangoapps/instructor/views/legacy.py +++ b/lms/djangoapps/instructor/views/legacy.py @@ -180,7 +180,7 @@ def instructor_dashboard(request, course_id): action = request.POST.get('action', '') use_offline = request.POST.get('use_offline_grades', False) - if settings.MITX_FEATURES['ENABLE_MANUAL_GIT_RELOAD']: + if settings.FEATURES['ENABLE_MANUAL_GIT_RELOAD']: if 'GIT pull' in action: data_dir = course.data_dir log.debug('git pull {0}'.format(data_dir)) @@ -766,7 +766,7 @@ def instructor_dashboard(request, course_id): msg += "<br/><font color='orange'>Grades from %s</font>" % offline_grades_available(course_id) # generate list of pending background tasks - if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): + if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): instructor_tasks = get_running_instructor_tasks(course_id) else: instructor_tasks = None @@ -794,7 +794,7 @@ def instructor_dashboard(request, course_id): # 1. Feature flag is on # 2. We have explicitly enabled email for the given course via django-admin # 3. It is NOT an XML course - if settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \ + if settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \ CourseAuthorization.instructor_email_enabled(course_id) and is_studio_course: show_email_tab = True @@ -805,7 +805,7 @@ def instructor_dashboard(request, course_id): # disable buttons for large courses disable_buttons = False - max_enrollment_for_buttons = settings.MITX_FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") + max_enrollment_for_buttons = settings.FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS") if max_enrollment_for_buttons is not None: disable_buttons = enrollment_number > max_enrollment_for_buttons @@ -841,7 +841,7 @@ def instructor_dashboard(request, course_id): 'disable_buttons': disable_buttons } - if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): + if settings.FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): context['beta_dashboard_url'] = reverse('instructor_dashboard_2', kwargs={'course_id': course_id}) return render_to_response('courseware/instructor_dashboard.html', context) @@ -856,9 +856,9 @@ def _do_remote_gradebook(user, course, action, args=None, files=None): msg = "No remote gradebook defined in course metadata" return msg, {} - rgurl = settings.MITX_FEATURES.get('REMOTE_GRADEBOOK_URL', '') + rgurl = settings.FEATURES.get('REMOTE_GRADEBOOK_URL', '') if not rgurl: - msg = "No remote gradebook url defined in settings.MITX_FEATURES" + msg = "No remote gradebook url defined in settings.FEATURES" return msg, {} rgname = rg.get('name', '') diff --git a/lms/djangoapps/notes/utils.py b/lms/djangoapps/notes/utils.py index e6e784ce4966a69810dc119be309d0b22664afc9..c34020694564ff072691a342446c954b3128d2b7 100644 --- a/lms/djangoapps/notes/utils.py +++ b/lms/djangoapps/notes/utils.py @@ -7,11 +7,11 @@ def notes_enabled_for_course(course): Returns True if the notes app is enabled for the course, False otherwise. In order for the app to be enabled it must be: - 1) enabled globally via MITX_FEATURES. + 1) enabled globally via FEATURES. 2) present in the course tab configuration. ''' tab_found = next((True for t in course.tabs if t['type'] == 'notes'), False) - feature_enabled = settings.MITX_FEATURES.get('ENABLE_STUDENT_NOTES') + feature_enabled = settings.FEATURES.get('ENABLE_STUDENT_NOTES') return feature_enabled and tab_found diff --git a/lms/djangoapps/shoppingcart/context_processor.py b/lms/djangoapps/shoppingcart/context_processor.py index b94f1cac2a398e019fd23ab59c150592afe7a2c0..95beb106d3d5b5542639e08d96f42afd13f90ea2 100644 --- a/lms/djangoapps/shoppingcart/context_processor.py +++ b/lms/djangoapps/shoppingcart/context_processor.py @@ -17,7 +17,7 @@ def user_has_cart_context_processor(request): """ return {'display_shopping_cart': ( request.user.is_authenticated() and # user is logged in and - settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and # settings enable paid course reg and - settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART') and # settings enable shopping cart and + settings.FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and # settings enable paid course reg and + settings.FEATURES.get('ENABLE_SHOPPING_CART') and # settings enable shopping cart and shoppingcart.models.Order.user_cart_has_items(request.user) # user's cart has items )} diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 7de62343c7787c43547159ad9d1f8d6c399053bf..93f35ebc468874b78fb21c8e05f50bfa1c1103a5 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -143,7 +143,7 @@ class Order(models.Model): self.bill_to_state = state self.bill_to_country = country self.bill_to_postalcode = postalcode - if settings.MITX_FEATURES['STORE_BILLING_INFO']: + if settings.FEATURES['STORE_BILLING_INFO']: self.bill_to_street1 = street1 self.bill_to_street2 = street2 self.bill_to_ccnum = ccnum @@ -164,7 +164,7 @@ class Order(models.Model): message = render_to_string('emails/order_confirmation_email.txt', { 'order': self, 'order_items': orderitems, - 'has_billing_info': settings.MITX_FEATURES['STORE_BILLING_INFO'] + 'has_billing_info': settings.FEATURES['STORE_BILLING_INFO'] }) try: send_mail(subject, message, diff --git a/lms/djangoapps/shoppingcart/tests/test_context_processor.py b/lms/djangoapps/shoppingcart/tests/test_context_processor.py index 4cedca8d14739cd2a49b2531f9ed5e3ff64d8d39..c7be12d86e51b52dc6aac33422bdc92f04524331 100644 --- a/lms/djangoapps/shoppingcart/tests/test_context_processor.py +++ b/lms/djangoapps/shoppingcart/tests/test_context_processor.py @@ -33,27 +33,27 @@ class UserCartContextProcessorUnitTest(ModuleStoreTestCase): cart = Order.get_cart_for_user(self.user) PaidCourseRegistration.add_to_order(cart, course.id) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_SHOPPING_CART': False, 'ENABLE_PAID_COURSE_REGISTRATION': True}) + @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': False, 'ENABLE_PAID_COURSE_REGISTRATION': True}) def test_no_enable_shoppingcart(self): """ - Tests when MITX_FEATURES['ENABLE_SHOPPING_CART'] is not set + Tests when FEATURES['ENABLE_SHOPPING_CART'] is not set """ self.add_to_cart() self.request.user = self.user context = user_has_cart_context_processor(self.request) self.assertFalse(context['display_shopping_cart']) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': False}) + @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': False}) def test_no_enable_paid_course_registration(self): """ - Tests when MITX_FEATURES['ENABLE_PAID_COURSE_REGISTRATION'] is not set + Tests when FEATURES['ENABLE_PAID_COURSE_REGISTRATION'] is not set """ self.add_to_cart() self.request.user = self.user context = user_has_cart_context_processor(self.request) self.assertFalse(context['display_shopping_cart']) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) + @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) def test_anonymous_user(self): """ Tests when request.user is anonymous @@ -62,7 +62,7 @@ class UserCartContextProcessorUnitTest(ModuleStoreTestCase): context = user_has_cart_context_processor(self.request) self.assertFalse(context['display_shopping_cart']) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) + @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) def test_no_items_in_cart(self): """ Tests when request.user doesn't have a cart with items @@ -71,7 +71,7 @@ class UserCartContextProcessorUnitTest(ModuleStoreTestCase): context = user_has_cart_context_processor(self.request) self.assertFalse(context['display_shopping_cart']) - @patch.dict(settings.MITX_FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) + @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True, 'ENABLE_PAID_COURSE_REGISTRATION': True}) def test_items_in_cart(self): """ Tests when request.user has a cart with items diff --git a/lms/djangoapps/shoppingcart/tests/test_models.py b/lms/djangoapps/shoppingcart/tests/test_models.py index a0161cbe0f41258de766f4c7c1c7075d4e5a6ec5..cf01204942d92b5cd3b7c633d097ecddf30ff479 100644 --- a/lms/djangoapps/shoppingcart/tests/test_models.py +++ b/lms/djangoapps/shoppingcart/tests/test_models.py @@ -161,7 +161,7 @@ class OrderTest(ModuleStoreTestCase): ) @patch('shoppingcart.models.render_to_string') - @patch.dict(settings.MITX_FEATURES, {'STORE_BILLING_INFO': True}) + @patch.dict(settings.FEATURES, {'STORE_BILLING_INFO': True}) def test_billing_info_storage_on(self, render): cart = Order.get_cart_for_user(self.user) self.purchase_with_data(cart) @@ -179,7 +179,7 @@ class OrderTest(ModuleStoreTestCase): self.assertTrue(context['has_billing_info']) @patch('shoppingcart.models.render_to_string') - @patch.dict(settings.MITX_FEATURES, {'STORE_BILLING_INFO': False}) + @patch.dict(settings.FEATURES, {'STORE_BILLING_INFO': False}) def test_billing_info_storage_off(self, render): cart = Order.get_cart_for_user(self.user) self.purchase_with_data(cart) diff --git a/lms/djangoapps/shoppingcart/urls.py b/lms/djangoapps/shoppingcart/urls.py index 3653c9152469dac8693366e518cd2cb36f6ee3f7..b9797e9a5b37cd83e41d6900a1523cf763cc7367 100644 --- a/lms/djangoapps/shoppingcart/urls.py +++ b/lms/djangoapps/shoppingcart/urls.py @@ -5,7 +5,7 @@ urlpatterns = patterns('shoppingcart.views', # nopep8 url(r'^postpay_callback/$', 'postpay_callback'), # Both the ~accept and ~reject callback pages are handled here url(r'^receipt/(?P<ordernum>[0-9]*)/$', 'show_receipt'), ) -if settings.MITX_FEATURES['ENABLE_SHOPPING_CART']: +if settings.FEATURES['ENABLE_SHOPPING_CART']: urlpatterns += patterns( 'shoppingcart.views', url(r'^$', 'show_cart'), @@ -15,7 +15,7 @@ if settings.MITX_FEATURES['ENABLE_SHOPPING_CART']: url(r'^csv_report/$', 'csv_report', name='payment_csv_report'), ) -if settings.MITX_FEATURES.get('ENABLE_PAYMENT_FAKE'): +if settings.FEATURES.get('ENABLE_PAYMENT_FAKE'): from shoppingcart.tests.payment_fake import PaymentFakeView urlpatterns += patterns( 'shoppingcart.tests.payment_fake', diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index 523e8393a40b51fbd344f8de4f770fff38dd0458..dccbdb430aebd452282f535ff5b68400f845e43a 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -477,7 +477,7 @@ class SoftwareSecurePhotoVerification(PhotoVerification): # developing and aren't interested in working on student identity # verification functionality. If you do want to work on it, you have to # explicitly enable these in your private settings. - if settings.MITX_FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): + if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): return aes_key_str = settings.VERIFY_STUDENT["SOFTWARE_SECURE"]["FACE_IMAGE_AES_KEY"] @@ -502,7 +502,7 @@ class SoftwareSecurePhotoVerification(PhotoVerification): # developing and aren't interested in working on student identity # verification functionality. If you do want to work on it, you have to # explicitly enable these in your private settings. - if settings.MITX_FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): + if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): return aes_key = random_aes_key() @@ -670,7 +670,7 @@ class SoftwareSecurePhotoVerification(PhotoVerification): # create the message because that would require encryption and message # signing that rely on settings.VERIFY_STUDENT values that aren't set # in dev. So we just pretend like we successfully posted - if settings.MITX_FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): + if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'): fake_response = requests.Response() fake_response.status_code = 200 return fake_response diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 43cbff15bd3bccdfae8b8aebcbee886b0db92e3e..c14f41d87b1b3f68186dcd21e8acf05ade4d8072 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -99,7 +99,7 @@ class TestReverifyView(TestCase): self.assertIn('photo_reverification', template) self.assertTrue(context['error']) - @patch.dict(settings.MITX_FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True}) + @patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True}) def test_reverify_post_success(self): url = reverse('verify_student_reverify') response = self.client.post(url, {'face_image': ',', diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 76db5b005b9c4a2d13bdace6904fa407478bce62..6b4b5f7665c0213998b72a021e919aa7e70fdf90 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -93,21 +93,21 @@ BULK_EMAIL_DEFAULT_FROM_EMAIL = "test@test.org" # Forums are disabled in test.py to speed up unit tests, but we do not have # per-test control for acceptance tests -MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True +FEATURES['ENABLE_DISCUSSION_SERVICE'] = True # Use the auto_auth workflow for creating users and logging them in -MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True +FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # Enable fake payment processing page -MITX_FEATURES['ENABLE_PAYMENT_FAKE'] = True +FEATURES['ENABLE_PAYMENT_FAKE'] = True # Enable email on the instructor dash -MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True -MITX_FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False +FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True +FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Don't actually send any requests to Software Secure for student identity # verification. -MITX_FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True +FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True # Configure the payment processor to use the fake processing page # Since both the fake payment page and the shoppingcart app are using @@ -128,7 +128,7 @@ CC_PROCESSOR['CyberSource']['PURCHASE_ENDPOINT'] = "/shoppingcart/payment_fake" # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True -MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True +FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 2e19887bf9c0f343d870de6bcf69548aee8041ef..abb382edba32540eca6f8260c63def992d3d2ebf 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -44,7 +44,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.cache' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # Enable Berkeley forums -MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True +FEATURES['ENABLE_DISCUSSION_SERVICE'] = True # IMPORTANT: With this enabled, the server must always be behind a proxy that # strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise, @@ -210,8 +210,8 @@ USE_I18N = ENV_TOKENS.get('USE_I18N', USE_I18N) for app in ENV_TOKENS.get('ADDL_INSTALLED_APPS', []): INSTALLED_APPS += (app,) -for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items(): - MITX_FEATURES[feature] = value +for feature, value in ENV_TOKENS.get('FEATURES', {}).items(): + FEATURES[feature] = value WIKI_ENABLED = ENV_TOKENS.get('WIKI_ENABLED', WIKI_ENABLED) local_loglevel = ENV_TOKENS.get('LOCAL_LOGLEVEL', 'INFO') @@ -258,7 +258,7 @@ with open(CONFIG_ROOT / CONFIG_PREFIX + "auth.json") as auth_file: # If Segment.io key specified, load it and enable Segment.io if the feature flag is set SEGMENT_IO_LMS_KEY = AUTH_TOKENS.get('SEGMENT_IO_LMS_KEY') if SEGMENT_IO_LMS_KEY: - MITX_FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False) + FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False) CC_PROCESSOR = AUTH_TOKENS.get('CC_PROCESSOR', CC_PROCESSOR) diff --git a/lms/envs/cms/acceptance.py b/lms/envs/cms/acceptance.py index 0b638dca8ae037687879a5e33b7234cf0c03710b..c1ba93f46fc5640596cfb2a9fd5be3f23b7ef07e 100644 --- a/lms/envs/cms/acceptance.py +++ b/lms/envs/cms/acceptance.py @@ -20,7 +20,7 @@ MIDDLEWARE_CLASSES = tuple(e for e in MIDDLEWARE_CLASSES \ ########################### LETTUCE TESTING ########################## -MITX_FEATURES['DISPLAY_TOY_COURSES'] = True +FEATURES['DISPLAY_TOY_COURSES'] = True INSTALLED_APPS += ('lettuce.django',) # INSTALLED_APPS += ('portal',) diff --git a/lms/envs/cms/dev.py b/lms/envs/cms/dev.py index f70d05653f5798e760a35140e7931636c26517a8..427b7a78d2ddab7184490cf22e8b55da7467e008 100644 --- a/lms/envs/cms/dev.py +++ b/lms/envs/cms/dev.py @@ -8,7 +8,7 @@ Settings for the LMS that runs alongside the CMS on AWS from ..dev import * -MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = False +FEATURES['AUTH_USE_MIT_CERTIFICATES'] = False SUBDOMAIN_BRANDING['edge'] = 'edge' SUBDOMAIN_BRANDING['preview.edge'] = 'edge' @@ -18,7 +18,7 @@ VIRTUAL_UNIVERSITIES = ['edge'] # modules. Since - for now - those links point to github (for XML based authoring), it seems broken # to people using it. Once we can update those links to properly link back to Studio, # then we can turn this flag back on, as well as enabling in aws.py configurations. -MITX_FEATURES['ENABLE_LMS_MIGRATION'] = False +FEATURES['ENABLE_LMS_MIGRATION'] = False META_UNIVERSITIES = {} diff --git a/lms/envs/common.py b/lms/envs/common.py index 2341e30cb128ea9686c3ee070108441dcf16f32f..7dbcb1cd468a70d7f3ebf6d312b75d06534342d0 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2,7 +2,7 @@ This is the common settings file, intended to set sane defaults. If you have a piece of configuration that's dependent on a set of feature flags being set, then create a function that returns the calculated value based on the value of -MITX_FEATURES[...]. Modules that extend this one can change the feature +FEATURES[...]. Modules that extend this one can change the feature configuration in an environment specific config file and re-calculate those values. @@ -14,7 +14,7 @@ Longer TODO: 1. Right now our treatment of static content in general and in particular course-specific static content is haphazard. 2. We should have a more disciplined approach to feature flagging, even if it - just means that we stick them in a dict called MITX_FEATURES. + just means that we stick them in a dict called FEATURES. 3. We need to handle configuration for multiple courses. This could be as multiple sites, but we do need a way to map their data assets. """ @@ -50,7 +50,7 @@ DISCUSSION_SETTINGS = { # Features -MITX_FEATURES = { +FEATURES = { 'SAMPLE': False, 'USE_DJANGO_PIPELINE': True, 'DISPLAY_HISTOGRAMS_TO_STAFF': True, @@ -360,7 +360,7 @@ TRACKING_BACKENDS = { # Backwards compatibility with ENABLE_SQL_TRACKING_LOGS feature flag. # In the future, adding the backend to TRACKING_BACKENDS enough. -if MITX_FEATURES.get('ENABLE_SQL_TRACKING_LOGS'): +if FEATURES.get('ENABLE_SQL_TRACKING_LOGS'): TRACKING_BACKENDS.update({ 'sql': { 'ENGINE': 'track.backends.django.DjangoBackend' @@ -1034,7 +1034,7 @@ def enable_theme(theme_name): THEME_NAME = "stanford" enable_theme(THEME_NAME) """ - MITX_FEATURES['USE_CUSTOM_THEME'] = True + FEATURES['USE_CUSTOM_THEME'] = True # Calculate the location of the theme's files theme_root = ENV_ROOT / "themes" / theme_name @@ -1055,7 +1055,7 @@ VERIFY_STUDENT = { ######################## CAS authentication ########################### -if MITX_FEATURES.get('AUTH_USE_CAS'): +if FEATURES.get('AUTH_USE_CAS'): CAS_SERVER_URL = 'https://provide_your_cas_url_here' AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 7ab58b008f0440eeee9bef208f49bce97295e792..9c5dd90ec7160951ab5e3d03302697ec79e2733f 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -24,23 +24,23 @@ LANGUAGES = ( TEMPLATE_DEBUG = True -MITX_FEATURES['DISABLE_START_DATES'] = False -MITX_FEATURES['ENABLE_SQL_TRACKING_LOGS'] = True -MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False # Enable to test subdomains--otherwise, want all courses to show up -MITX_FEATURES['SUBDOMAIN_BRANDING'] = True -MITX_FEATURES['FORCE_UNIVERSITY_DOMAIN'] = None # show all university courses if in dev (ie don't use HTTP_HOST) -MITX_FEATURES['ENABLE_MANUAL_GIT_RELOAD'] = True -MITX_FEATURES['ENABLE_PSYCHOMETRICS'] = False # real-time psychometrics (eg item response theory analysis in instructor dashboard) -MITX_FEATURES['ENABLE_INSTRUCTOR_ANALYTICS'] = True -MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True -MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses -MITX_FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms) -MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True -MITX_FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True -MITX_FEATURES['MULTIPLE_ENROLLMENT_ROLES'] = True -MITX_FEATURES['ENABLE_SHOPPING_CART'] = True -MITX_FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True -MITX_FEATURES['ENABLE_S3_GRADE_DOWNLOADS'] = True +FEATURES['DISABLE_START_DATES'] = False +FEATURES['ENABLE_SQL_TRACKING_LOGS'] = True +FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False # Enable to test subdomains--otherwise, want all courses to show up +FEATURES['SUBDOMAIN_BRANDING'] = True +FEATURES['FORCE_UNIVERSITY_DOMAIN'] = None # show all university courses if in dev (ie don't use HTTP_HOST) +FEATURES['ENABLE_MANUAL_GIT_RELOAD'] = True +FEATURES['ENABLE_PSYCHOMETRICS'] = False # real-time psychometrics (eg item response theory analysis in instructor dashboard) +FEATURES['ENABLE_INSTRUCTOR_ANALYTICS'] = True +FEATURES['ENABLE_SERVICE_STATUS'] = True +FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses +FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms) +FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True +FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True +FEATURES['MULTIPLE_ENROLLMENT_ROLES'] = True +FEATURES['ENABLE_SHOPPING_CART'] = True +FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True +FEATURES['ENABLE_S3_GRADE_DOWNLOADS'] = True FEEDBACK_SUBMISSION_EMAIL = "dummy@example.com" @@ -174,9 +174,9 @@ OPEN_ENDED_GRADING_INTERFACE = { } ############################## LMS Migration ################################## -MITX_FEATURES['ENABLE_LMS_MIGRATION'] = True -MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False # require that user be in the staff_* group to be able to enroll -MITX_FEATURES['USE_XQA_SERVER'] = 'http://xqa:server@content-qa.mitx.mit.edu/xqa' +FEATURES['ENABLE_LMS_MIGRATION'] = True +FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False # require that user be in the staff_* group to be able to enroll +FEATURES['USE_XQA_SERVER'] = 'http://xqa:server@content-qa.edX.mit.edu/xqa' INSTALLED_APPS += ('lms_migration',) @@ -184,9 +184,9 @@ LMS_MIGRATION_ALLOWED_IPS = ['127.0.0.1'] ################################ OpenID Auth ################################# -MITX_FEATURES['AUTH_USE_OPENID'] = True -MITX_FEATURES['AUTH_USE_OPENID_PROVIDER'] = True -MITX_FEATURES['BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH'] = True +FEATURES['AUTH_USE_OPENID'] = True +FEATURES['AUTH_USE_OPENID_PROVIDER'] = True +FEATURES['BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH'] = True INSTALLED_APPS += ('external_auth',) INSTALLED_APPS += ('django_openid_auth',) @@ -200,7 +200,7 @@ OPENID_PROVIDER_TRUSTED_ROOTS = ['*'] ######################## MIT Certificates SSL Auth ############################ -MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True +FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True ################################# CELERY ###################################### @@ -247,8 +247,8 @@ FILE_UPLOAD_HANDLERS = ( 'django.core.files.uploadhandler.TemporaryFileUploadHandler', ) -MITX_FEATURES['AUTH_USE_SHIB'] = True -MITX_FEATURES['RESTRICT_ENROLL_BY_REG_METHOD'] = True +FEATURES['AUTH_USE_SHIB'] = True +FEATURES['RESTRICT_ENROLL_BY_REG_METHOD'] = True ########################### PIPELINE ################################# @@ -264,7 +264,7 @@ ANALYTICS_API_KEY = "" # If there's an environment variable set, grab it and turn on Segment.io SEGMENT_IO_LMS_KEY = os.environ.get('SEGMENT_IO_LMS_KEY') if SEGMENT_IO_LMS_KEY: - MITX_FEATURES['SEGMENT_IO_LMS'] = True + FEATURES['SEGMENT_IO_LMS'] = True ###################### Payment ##############################3 @@ -279,7 +279,7 @@ EDX_API_KEY = None ####################### Shoppingcart ########################### -MITX_FEATURES['ENABLE_SHOPPING_CART'] = True +FEATURES['ENABLE_SHOPPING_CART'] = True ##################################################################### # Lastly, see if the developer has any local overrides. diff --git a/lms/envs/dev_ike.py b/lms/envs/dev_ike.py index 0123c5c1e0afb3bbd085f50898a524c13a852786..92c40b53e181f7ac6f31687117bbf72093d269b4 100644 --- a/lms/envs/dev_ike.py +++ b/lms/envs/dev_ike.py @@ -17,28 +17,28 @@ from .dev import * import socket WIKI_ENABLED = False -MITX_FEATURES['ENABLE_TEXTBOOK'] = False -MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = True # require that user be in the staff_* group to be able to enroll -MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False -MITX_FEATURES['SUBDOMAIN_BRANDING'] = False -MITX_FEATURES['FORCE_UNIVERSITY_DOMAIN'] = None # show all university courses if in dev (ie don't use HTTP_HOST) +FEATURES['ENABLE_TEXTBOOK'] = False +FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = True # require that user be in the staff_* group to be able to enroll +FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False +FEATURES['SUBDOMAIN_BRANDING'] = False +FEATURES['FORCE_UNIVERSITY_DOMAIN'] = None # show all university courses if in dev (ie don't use HTTP_HOST) -MITX_FEATURES['DISABLE_START_DATES'] = True -# MITX_FEATURES['USE_DJANGO_PIPELINE']=False # don't recompile scss +FEATURES['DISABLE_START_DATES'] = True +# FEATURES['USE_DJANGO_PIPELINE']=False # don't recompile scss myhost = socket.gethostname() if ('edxvm' in myhost) or ('ocw' in myhost): - MITX_FEATURES['DISABLE_LOGIN_BUTTON'] = True # auto-login with MIT certificate - MITX_FEATURES['USE_XQA_SERVER'] = 'https://qisx.mit.edu/xqa' # needs to be ssl or browser blocks it - MITX_FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss + FEATURES['DISABLE_LOGIN_BUTTON'] = True # auto-login with MIT certificate + FEATURES['USE_XQA_SERVER'] = 'https://qisx.mit.edu/xqa' # needs to be ssl or browser blocks it + FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss if ('ocw' in myhost): - MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False + FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False if ('domU' in myhost): EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' - MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@mitx.mit.edu' # nonempty string = address for all activation emails - MITX_FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss + FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@edX.mit.edu' # nonempty string = address for all activation emails + FEATURES['USE_DJANGO_PIPELINE'] = False # don't recompile scss SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') # django 1.4 for nginx ssl proxy diff --git a/lms/envs/dev_int.py b/lms/envs/dev_int.py index 34921205a6ded1c1acb5b6f9d12f42fa7a455db5..f5636a51294ed7f6bdb0beaa4cd1bebe89929b6b 100644 --- a/lms/envs/dev_int.py +++ b/lms/envs/dev_int.py @@ -16,7 +16,7 @@ use *.dev domains instead for local testing. from .dev import * -MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = True +FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = True COURSE_LISTINGS = { 'default': ['BerkeleyX/CS169.1x/2012_Fall', diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 0b1c8feeaad23ce99d98a7295567cfebf3af4e65..5a75bd7e36dbbe94ed02d74f6b6bb6c5f6a4965f 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -23,8 +23,8 @@ for pkg_name in ['track.contexts', 'track.middleware', 'dd.dogapi']: ################################ EMAIL ######################################## EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses -MITX_FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms) +FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses +FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms) ################################ DEBUG TOOLBAR ################################ diff --git a/lms/envs/test.py b/lms/envs/test.py index 49f8d29aa2e8bd9421e9535063345a56e7e33641..111c9316ae6409757efb8f476658c3a6a309d22a 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -21,20 +21,20 @@ os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = 'localhost:8000-9000' # can't test start dates with this True, but on the other hand, # can test everything else :) -MITX_FEATURES['DISABLE_START_DATES'] = True +FEATURES['DISABLE_START_DATES'] = True # Most tests don't use the discussion service, so we turn it off to speed them up. # Tests that do can enable this flag, but must use the UrlResetMixin class to force urls.py # to reload -MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = False +FEATURES['ENABLE_DISCUSSION_SERVICE'] = False -MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True +FEATURES['ENABLE_SERVICE_STATUS'] = True -MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True +FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True -MITX_FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True +FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True -MITX_FEATURES['ENABLE_SHOPPING_CART'] = True +FEATURES['ENABLE_SHOPPING_CART'] = True # Need wiki for courseware views to work. TODO (vshnayder): shouldn't need it. WIKI_ENABLED = True @@ -171,13 +171,13 @@ SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd' filterwarnings('ignore', message='No request passed to the backend, unable to rate-limit') ################################## OPENID ##################################### -MITX_FEATURES['AUTH_USE_OPENID'] = True -MITX_FEATURES['AUTH_USE_OPENID_PROVIDER'] = True +FEATURES['AUTH_USE_OPENID'] = True +FEATURES['AUTH_USE_OPENID_PROVIDER'] = True ################################## SHIB ####################################### -MITX_FEATURES['AUTH_USE_SHIB'] = True -MITX_FEATURES['SHIB_DISABLE_TOS'] = True -MITX_FEATURES['RESTRICT_ENROLL_BY_REG_METHOD'] = True +FEATURES['AUTH_USE_SHIB'] = True +FEATURES['SHIB_DISABLE_TOS'] = True +FEATURES['RESTRICT_ENROLL_BY_REG_METHOD'] = True OPENID_CREATE_USERS = False OPENID_UPDATE_DETAILS_FROM_SREG = True @@ -186,7 +186,7 @@ OPENID_PROVIDER_TRUSTED_ROOTS = ['*'] ###################### Payment ##############################3 # Enable fake payment processing page -MITX_FEATURES['ENABLE_PAYMENT_FAKE'] = True +FEATURES['ENABLE_PAYMENT_FAKE'] = True # Configure the payment processor to use the fake processing page # Since both the fake payment page and the shoppingcart app are using # the same settings, we can generate this randomly and guarantee diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 0afce28595701aa53868017ce511c442d2db9922..81e9e2507f2e0c5f62cb58a56aa08dd5f41fcbdf 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -5,7 +5,7 @@ from courseware.access import has_access from django.conf import settings - if settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART'): + if settings.FEATURES.get('ENABLE_SHOPPING_CART'): cart_link = reverse('shoppingcart.views.show_cart') else: cart_link = "" @@ -31,7 +31,7 @@ event.preventDefault(); }); - % if settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART') and settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION'): + % if settings.FEATURES.get('ENABLE_SHOPPING_CART') and settings.FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION'): add_course_complete_handler = function(jqXHR, textStatus) { if (jqXHR.status == 200) { location.href = "${cart_link}"; @@ -57,7 +57,7 @@ % endif ## making the conditional around this entire JS block for sanity - %if settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: + %if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: $('#class_enroll_form').on('ajax:complete', function(event, xhr) { if(xhr.status == 200) { location.href = "${reverse('dashboard')}"; @@ -135,7 +135,7 @@ <span class="add-to-cart"> ${_('This course is in your <a href="{cart_link}">cart</a>.').format(cart_link=cart_link)} </span> - %elif settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and registration_price: + %elif settings.FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and registration_price: <% if user.is_authenticated(): reg_href = "#" diff --git a/lms/templates/courseware/instructor_dashboard.html b/lms/templates/courseware/instructor_dashboard.html index c2488694225cb71b669206fdc1d588801a381a2f..cd78ef0c6ca9fbaf5b9e515246f6f4395f32b594 100644 --- a/lms/templates/courseware/instructor_dashboard.html +++ b/lms/templates/courseware/instructor_dashboard.html @@ -113,7 +113,7 @@ function goto( mode) <section class="container"> <div class="instructor-dashboard-wrapper"> - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): <div class="beta-button-wrapper"><a href="${ beta_dashboard_url }">${_("Try New Beta Dashboard")}</a></div> %endif %if studio_url: @@ -126,7 +126,7 @@ function goto( mode) <h1>${_("Instructor Dashboard")}</h1> <h2 class="navbar">[ <a href="#" onclick="goto('Grades');" class="${modeflag.get('Grades')}">Grades</a> | - %if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS'): + %if settings.FEATURES.get('ENABLE_PSYCHOMETRICS'): <a href="#" onclick="goto('Psychometrics');" class="${modeflag.get('Psychometrics')}">${_("Psychometrics")}</a> | %endif <a href="#" onclick="goto('Admin');" class="${modeflag.get('Admin')}">${_("Admin")}</a> | @@ -137,7 +137,7 @@ function goto( mode) %if show_email_tab: | <a href="#" onclick="goto('Email')" class="${modeflag.get('Email')}">${_("Email")}</a> %endif - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_ANALYTICS'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_ANALYTICS'): | <a href="#" onclick="goto('Analytics');" class="${modeflag.get('Analytics')}">${_("Analytics")}</a> %endif ] @@ -172,7 +172,7 @@ function goto( mode) "with more than {max_enrollment} students. We are urgently working on " "fixing this issue. Thank you for your patience as we continue " "working to improve the platform!").format( - max_enrollment=settings.MITX_FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] + max_enrollment=settings.FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] )} </p> </div> @@ -207,7 +207,7 @@ function goto( mode) </p> <hr width="40%" style="align:left"> - %if settings.MITX_FEATURES.get('REMOTE_GRADEBOOK_URL','') and instructor_access: + %if settings.FEATURES.get('REMOTE_GRADEBOOK_URL','') and instructor_access: <% rg = course.remote_gradebook @@ -240,7 +240,7 @@ function goto( mode) <hr width="40%" style="align:left"> %endif - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <H2>${_("Course-specific grade adjustment")}</h2> <p> @@ -292,7 +292,7 @@ function goto( mode) <p> ${_("Then select an action:")} <input type="submit" name="action" value="Reset student's attempts"> - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <input type="submit" name="action" value="Rescore student's problem submission"> %endif </p> @@ -303,7 +303,7 @@ function goto( mode) <input type="submit" name="action" value="Delete student state for module"> </p> %endif - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <p>${_("Rescoring runs in the background, and status for active tasks will appear in a table below. " "To see status for all tasks submitted for this problem and student, click on this button:")} </p> @@ -359,7 +359,7 @@ function goto( mode) <hr width="40%" style="align:left"> %endif - %if settings.MITX_FEATURES['ENABLE_MANUAL_GIT_RELOAD'] and admin_access: + %if settings.FEATURES['ENABLE_MANUAL_GIT_RELOAD'] and admin_access: <p> <input type="submit" name="action" value="Reload course from XML files"> <input type="submit" name="action" value="GIT pull and Reload course"> @@ -409,7 +409,7 @@ function goto( mode) "with more than {max_enrollment} students. We are urgently working on " "fixing this issue. Thank you for your patience as we continue " "working to improve the platform!").format( - max_enrollment=settings.MITX_FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] + max_enrollment=settings.FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] )} </p> </div> @@ -420,7 +420,7 @@ function goto( mode) <input type="submit" name="action" value="List students who may enroll but may not have yet signed up" class="${'is-disabled' if disable_buttons else ''}"> <hr width="40%" style="align:left"> - %if settings.MITX_FEATURES.get('REMOTE_GRADEBOOK_URL','') and instructor_access: + %if settings.FEATURES.get('REMOTE_GRADEBOOK_URL','') and instructor_access: <% rg = course.remote_gradebook diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 9d9600475cba1a0f5f0b525ffd90514760981810..306248b40165a59caf0c2ff5d41f207c04fe43f0 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -197,7 +197,7 @@ </ul> % else: <section class="empty-dashboard-message"> - % if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'): + % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): <p>${_("Looks like you haven't registered for any courses yet.")}</p> <a href="${marketing_link('COURSES')}"> ${_("Find courses now!")} diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 9d7d150cf2576de01dfa55d74750d7f768ec46e4..854a53bdf0efe5781f5653b226684cbd566b9ac0 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -184,8 +184,8 @@ % if course and course.display_name_with_default: <h1 class="home-title">${course.display_name_with_default}</h1> </section> - - % if settings.MITX_FEATURES.get('ENABLE_DISCUSSION_HOME_PANEL'): + + % if settings.FEATURES.get('ENABLE_DISCUSSION_HOME_PANEL'): <span class="label label-settings">HOW TO USE EDX DISCUSSIONS</span> <table class="home-helpgrid"> <tr class="helpgrid-row helpgrid-row-navigation"> diff --git a/lms/templates/help_modal.html b/lms/templates/help_modal.html index dea4b7e8b9d47f369b224c0c0ea0b29d1e340ade..7568af9c755bc1fec5be79be7f6482c7635003bc 100644 --- a/lms/templates/help_modal.html +++ b/lms/templates/help_modal.html @@ -6,7 +6,7 @@ <%! from django.conf import settings %> <%! from courseware.tabs import get_discussion_link %> -% if settings.MITX_FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): +% if settings.FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): <div class="help-tab"> <a href="#help-modal" rel="leanModal" role="button">${_("Help")}</a> diff --git a/lms/templates/index.html b/lms/templates/index.html index 83024e01aa7b75af827b9a1886adbe502cab47de..56d08ce1108ff08d5c86b163f534951d3a0f8e25 100644 --- a/lms/templates/index.html +++ b/lms/templates/index.html @@ -165,7 +165,7 @@ </section> % endif - % if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'): + % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): <section class="courses"> <ul class="courses-listing"> %for course in courses: diff --git a/lms/templates/instructor/instructor_dashboard_2/course_info.html b/lms/templates/instructor/instructor_dashboard_2/course_info.html index 7362014b09987ee0fbd35f20871daa76b7223e44..3569251e790e4fa7fcac6a2b87d90857f31e0c2d 100644 --- a/lms/templates/instructor/instructor_dashboard_2/course_info.html +++ b/lms/templates/instructor/instructor_dashboard_2/course_info.html @@ -58,7 +58,7 @@ </div> -%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): +%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <div class="running-tasks-container action-type-container"> <hr> <h2> ${_("Pending Instructor Tasks")} </h2> diff --git a/lms/templates/instructor/instructor_dashboard_2/data_download.html b/lms/templates/instructor/instructor_dashboard_2/data_download.html index cbbc2a871bba55cd1d145d535ac72d918c9533eb..4ed0ba8ede1d1ed64fe30555e697d9f11c86878d 100644 --- a/lms/templates/instructor/instructor_dashboard_2/data_download.html +++ b/lms/templates/instructor/instructor_dashboard_2/data_download.html @@ -23,12 +23,12 @@ <p><input type="button" name="list-anon-ids" value="${_("Get Student Anonymized IDs CSV")}" data-csv="true" class="csv" data-endpoint="${ section_data['get_anon_ids_url'] }" class="${'is-disabled' if disable_buttons else ''}"></p> </div> -%if settings.MITX_FEATURES.get('ENABLE_S3_GRADE_DOWNLOADS'): +%if settings.FEATURES.get('ENABLE_S3_GRADE_DOWNLOADS'): <div class="grades-download-container action-type-container"> <hr> <h2> ${_("Grade Reports")}</h2> - %if settings.MITX_FEATURES.get('ALLOW_COURSE_STAFF_GRADE_DOWNLOADS') or section_data['access']['admin']: + %if settings.FEATURES.get('ALLOW_COURSE_STAFF_GRADE_DOWNLOADS') or section_data['access']['admin']: <p>${_("The following button will generate a CSV grade report for all currently enrolled students. For large courses, generating this report may take a few hours.")}</p> <p>${_("The report is generated in the background, meaning it is OK to navigate away from this page while your report is generating. Generated reports appear in a table below and can be downloaded.")}</p> @@ -46,7 +46,7 @@ </div> %endif -%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): +%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <div class="running-tasks-container action-type-container"> <hr> <h2> ${_("Pending Instructor Tasks")} </h2> diff --git a/lms/templates/instructor/instructor_dashboard_2/send_email.html b/lms/templates/instructor/instructor_dashboard_2/send_email.html index 4d49530b5c68116aee41685633b7ab4d85a3a1a7..ff9514ddbee2ebf879b35487481e869625d8ac63 100644 --- a/lms/templates/instructor/instructor_dashboard_2/send_email.html +++ b/lms/templates/instructor/instructor_dashboard_2/send_email.html @@ -55,7 +55,7 @@ <input type="button" name="send" value="${_("Send Email")}" data-endpoint="${ section_data['send_email'] }" > <div class="request-response-error"></div> -%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): +%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <div class="running-tasks-container action-type-container"> <hr> <h2> ${_("Pending Instructor Tasks")} </h2> diff --git a/lms/templates/instructor/instructor_dashboard_2/student_admin.html b/lms/templates/instructor/instructor_dashboard_2/student_admin.html index 2762ba489903b614d51804fa86de0e71330f4b01..57d8aba8e77788264f410847fe4b31582d2f5eb4 100644 --- a/lms/templates/instructor/instructor_dashboard_2/student_admin.html +++ b/lms/templates/instructor/instructor_dashboard_2/student_admin.html @@ -50,7 +50,7 @@ <p> <input type="button" name="reset-attempts-single" value="${_("Reset Student Attempts")}" data-endpoint="${ section_data['reset_student_attempts_url'] }"> - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: <input type="button" name="rescore-problem-single" value="${_("Rescore Student Submission")}" data-endpoint="${ section_data['rescore_problem_url'] }"> %endif </p> @@ -63,7 +63,7 @@ </p> - %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: <p> ${_("Rescoring runs in the background, and status for active tasks will appear in the 'Pending Instructor Tasks' table. " "To see status for all tasks submitted for this problem and student, click on this button:")} @@ -75,7 +75,7 @@ <hr> </div> -%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: +%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: <div class="course-specific-container action-type-container"> <h2>${_('Course-specific grade adjustment')}</h2> <div class="request-response-error"></div> @@ -108,7 +108,7 @@ </div> %endif -%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): +%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): <div class="running-tasks-container action-type-container"> <hr> <h2> ${_("Pending Instructor Tasks")} </h2> diff --git a/lms/templates/login.html b/lms/templates/login.html index 56a04d6283970a013b7f2f54886aeaa9473b263f..72d903eed2ce83ada651027be17657831cd81f01 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -170,7 +170,7 @@ <h2 class="sr">${_("Helpful Information")}</h2> </header> - % if settings.MITX_FEATURES.get('AUTH_USE_OPENID'): + % if settings.FEATURES.get('AUTH_USE_OPENID'): <!-- <div class="cta cta-login-options-openid"> <h3>${_("Login via OpenID")}</h3> <p>${_('You can now start learning with {platform_name} by logging in with your <a rel="external" href="http://openid.net/">OpenID account</a>.').format(platform_name=settings.PLATFORM_NAME)}</p> diff --git a/lms/templates/login_modal.html b/lms/templates/login_modal.html index 4e88f07678cf3b4b56ed1a9cd0ab8d78a40bdb8c..676f352467411409e7a6ce7f3b74b092c74afcbd 100644 --- a/lms/templates/login_modal.html +++ b/lms/templates/login_modal.html @@ -34,7 +34,7 @@ <span>${_('Not enrolled?')} <a href="#signup-modal" class="close-login" rel="leanModal">${_('Sign up.')}</a></span> <a href="#forgot-password-modal" rel="leanModal" class="pwd-reset">${_('Forgot password?')}</a> </p> -% if settings.MITX_FEATURES.get('AUTH_USE_OPENID'): +% if settings.FEATURES.get('AUTH_USE_OPENID'): <p> <a href="${MITX_ROOT_URL}/openid/login/">${_('login via openid')}</a> </p> diff --git a/lms/templates/main.html b/lms/templates/main.html index 2d1c98db2762e6fec780f176e5a3645660a3d181..2d001ffe65c0eda99bb59bca0aa4324a6afd43d6 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -8,7 +8,7 @@ ## templates have access to these functions, and we can import these ## into non-inheriting templates via the %namespace tag. <%def name="theme_enabled()"> - <% return settings.MITX_FEATURES["USE_CUSTOM_THEME"] %> + <% return settings.FEATURES["USE_CUSTOM_THEME"] %> </%def> <%def name="stanford_theme_enabled()"> diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index 2dc571c24700bc5a30f5351421ab89192ad8a76c..bb847ed09a363dccf9a2a1484f246624bb25de22 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -57,11 +57,11 @@ site_status_msg = get_site_status_msg(course_id) <ol class="left nav-global authenticated"> <%block name="navigation_global_links_authenticated"> - % if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'): + % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): <li class="nav-global-01"> <a href="${marketing_link('COURSES')}">${_('Find Courses')}</a> </li> - % endif + % endif </%block> </ol> <ol class="user"> @@ -93,7 +93,7 @@ site_status_msg = get_site_status_msg(course_id) % else: <ol class="left nav-global"> <%block name="navigation_global_links"> - % if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE'): + % if settings.FEATURES.get('ENABLE_MKTG_SITE'): <li class="nav-global-01"> <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a> </li> @@ -105,8 +105,8 @@ site_status_msg = get_site_status_msg(course_id) </li> % endif </%block> - % if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']: - % if course and settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: + % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: + % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: <li class="nav-global-04"> <a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id])}">${_("Register Now")}</a> </li> @@ -120,8 +120,8 @@ site_status_msg = get_site_status_msg(course_id) <ol class="right nav-courseware"> <li class="nav-courseware-01"> - % if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']: - % if course and settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: + % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: + % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: <a class="cta cta-login" href="${reverse('course-specific-login', args=[course.id])}${login_query()}">${_("Log in")}</a> % else: <a class="cta cta-login" href="/login${login_query()}">${_("Log in")}</a> diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html index 7f876740474b47fd57567fb8115e3830ec5d6850..7e55612034991d8bfd4ccbe0679e11e3fd07ff25 100644 --- a/lms/templates/staff_problem_info.html +++ b/lms/templates/staff_problem_info.html @@ -18,7 +18,7 @@ ${block_content} % endif <div><a href="#${element_id}_debug" id="${element_id}_trig">${_("Staff Debug Info")}</a></div> -% if settings.MITX_FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW') and \ +% if settings.FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW') and \ location.category == 'problem': <div><a href="#${element_id}_history" id="${element_id}_history_trig">${_("Submission history")}</a></div> % endif diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html index 87dc0eebe0744d0013c076e14493b7423a802757..135a946811842750aa914c8e74b759b6ace652a9 100644 --- a/lms/templates/widgets/segment-io.html +++ b/lms/templates/widgets/segment-io.html @@ -1,4 +1,4 @@ -% if settings.MITX_FEATURES.get('SEGMENT_IO_LMS'): +% if settings.FEATURES.get('SEGMENT_IO_LMS'): <!-- begin Segment.io --> <%! from django.core.urlresolvers import reverse %> <%! import waffle %> diff --git a/lms/urls.py b/lms/urls.py index 913c686f1beac77d509c99ba3b15fa0e0f6ff079..18351f37a646cbbd3c2c8380f1407254f9e57fb5 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -6,7 +6,7 @@ from django.conf.urls.static import static import django.contrib.auth.views # Uncomment the next two lines to enable the admin: -if settings.DEBUG or settings.MITX_FEATURES.get('ENABLE_DJANGO_ADMIN_SITE'): +if settings.DEBUG or settings.FEATURES.get('ENABLE_DJANGO_ADMIN_SITE'): admin.autodiscover() urlpatterns = ('', # nopep8 @@ -63,7 +63,7 @@ urlpatterns = ('', # nopep8 url(r'^', include('waffle.urls')), ) -# if settings.MITX_FEATURES.get("MULTIPLE_ENROLLMENT_ROLES"): +# if settings.FEATURES.get("MULTIPLE_ENROLLMENT_ROLES"): urlpatterns += ( url(r'^verify_student/', include('verify_student.urls')), url(r'^course_modes/', include('course_modes.urls')), @@ -87,7 +87,7 @@ urlpatterns += ( ) # Semi-static views only used by edX, not by themes -if not settings.MITX_FEATURES["USE_CUSTOM_THEME"]: +if not settings.FEATURES["USE_CUSTOM_THEME"]: urlpatterns += ( url(r'^jobs$', 'static_template_view.views.render', {'template': 'jobs.html'}, name="jobs"), @@ -130,7 +130,7 @@ for key, value in settings.MKTG_URL_LINK_MAP.items(): # To allow theme templates to inherit from default templates, # prepend a standard prefix - if settings.MITX_FEATURES["USE_CUSTOM_THEME"]: + if settings.FEATURES["USE_CUSTOM_THEME"]: template = "theme-" + template # Make the assumption that the URL we want is the lowercased @@ -318,13 +318,13 @@ if settings.COURSEWARE_ENABLED: ) # allow course staff to change to student view of courseware - if settings.MITX_FEATURES.get('ENABLE_MASQUERADE'): + if settings.FEATURES.get('ENABLE_MASQUERADE'): urlpatterns += ( url(r'^masquerade/(?P<marg>.*)$', 'courseware.masquerade.handle_ajax', name="masquerade-switch"), ) # discussion forums live within courseware, so courseware must be enabled first - if settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'): + if settings.FEATURES.get('ENABLE_DISCUSSION_SERVICE'): urlpatterns += ( url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/discussion/', include('django_comment_client.urls')), @@ -339,7 +339,7 @@ if settings.COURSEWARE_ENABLED: 'courseware.views.static_tab', name="static_tab"), ) - if settings.MITX_FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'): + if settings.FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'): urlpatterns += ( url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/submission_history/(?P<student_username>[^/]*)/(?P<location>.*?)$', 'courseware.views.submission_history', @@ -347,7 +347,7 @@ if settings.COURSEWARE_ENABLED: ) -if settings.COURSEWARE_ENABLED and settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): +if settings.COURSEWARE_ENABLED and settings.FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'): urlpatterns += ( url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor_dashboard$', 'instructor.views.instructor_dashboard.instructor_dashboard_2', name="instructor_dashboard_2"), @@ -356,29 +356,29 @@ if settings.COURSEWARE_ENABLED and settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR include('instructor.views.api_urls')) ) -if settings.DEBUG or settings.MITX_FEATURES.get('ENABLE_DJANGO_ADMIN_SITE'): +if settings.DEBUG or settings.FEATURES.get('ENABLE_DJANGO_ADMIN_SITE'): ## Jasmine and admin urlpatterns += (url(r'^admin/', include(admin.site.urls)),) -if settings.MITX_FEATURES.get('AUTH_USE_OPENID'): +if settings.FEATURES.get('AUTH_USE_OPENID'): urlpatterns += ( url(r'^openid/login/$', 'django_openid_auth.views.login_begin', name='openid-login'), url(r'^openid/complete/$', 'external_auth.views.openid_login_complete', name='openid-complete'), url(r'^openid/logo.gif$', 'django_openid_auth.views.logo', name='openid-logo'), ) -if settings.MITX_FEATURES.get('AUTH_USE_SHIB'): +if settings.FEATURES.get('AUTH_USE_SHIB'): urlpatterns += ( url(r'^shib-login/$', 'external_auth.views.shib_login', name='shib-login'), ) -if settings.MITX_FEATURES.get('AUTH_USE_CAS'): +if settings.FEATURES.get('AUTH_USE_CAS'): urlpatterns += ( url(r'^cas-auth/login/$', 'external_auth.views.cas_login', name="cas-login"), url(r'^cas-auth/logout/$', 'django_cas.views.logout', {'next_page': '/'}, name="cas-logout"), ) -if settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD'): +if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD'): urlpatterns += ( url(r'^course_specific_login/(?P<course_id>[^/]+/[^/]+/[^/]+)/$', 'external_auth.views.course_specific_login', name='course-specific-login'), @@ -393,7 +393,7 @@ urlpatterns += ( ) -if settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'): +if settings.FEATURES.get('AUTH_USE_OPENID_PROVIDER'): urlpatterns += ( url(r'^openid/provider/login/$', 'external_auth.views.provider_login', name='openid-provider-login'), url(r'^openid/provider/login/(?:.+)$', 'external_auth.views.provider_identity', name='openid-provider-login-identity'), @@ -401,7 +401,7 @@ if settings.MITX_FEATURES.get('AUTH_USE_OPENID_PROVIDER'): url(r'^openid/provider/xrds/$', 'external_auth.views.provider_xrds', name='openid-provider-xrds') ) -if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'): +if settings.FEATURES.get('ENABLE_LMS_MIGRATION'): urlpatterns += ( url(r'^migrate/modules$', 'lms_migration.migrate.manage_modulestores'), url(r'^migrate/reload/(?P<reload_dir>[^/]+)$', 'lms_migration.migrate.manage_modulestores'), @@ -410,23 +410,23 @@ if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'): url(r'^gitreload/(?P<reload_dir>[^/]+)$', 'lms_migration.migrate.gitreload'), ) -if settings.MITX_FEATURES.get('ENABLE_SQL_TRACKING_LOGS'): +if settings.FEATURES.get('ENABLE_SQL_TRACKING_LOGS'): urlpatterns += ( url(r'^event_logs$', 'track.views.view_tracking_log'), url(r'^event_logs/(?P<args>.+)$', 'track.views.view_tracking_log'), ) -if settings.MITX_FEATURES.get('ENABLE_SERVICE_STATUS'): +if settings.FEATURES.get('ENABLE_SERVICE_STATUS'): urlpatterns += ( url(r'^status/', include('service_status.urls')), ) -if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): +if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): urlpatterns += ( url(r'^instructor_task_status/$', 'instructor_task.views.instructor_task_status', name='instructor_task_status'), ) -if settings.MITX_FEATURES.get('RUN_AS_ANALYTICS_SERVER_ENABLED'): +if settings.FEATURES.get('RUN_AS_ANALYTICS_SERVER_ENABLED'): urlpatterns += ( url(r'^edinsights_service/', include('edinsights.core.urls')), ) @@ -438,20 +438,20 @@ urlpatterns += ( url(r'^comm/foldit_ops', 'foldit.views.foldit_ops', name="foldit_ops"), ) -if settings.MITX_FEATURES.get('ENABLE_DEBUG_RUN_PYTHON'): +if settings.FEATURES.get('ENABLE_DEBUG_RUN_PYTHON'): urlpatterns += ( url(r'^debug/run_python', 'debug.views.run_python'), ) # Crowdsourced hinting instructor manager. -if settings.MITX_FEATURES.get('ENABLE_HINTER_INSTRUCTOR_VIEW'): +if settings.FEATURES.get('ENABLE_HINTER_INSTRUCTOR_VIEW'): urlpatterns += ( url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/hint_manager$', 'instructor.hint_manager.hint_manager', name="hint_manager"), ) # enable automatic login -if settings.MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING'): +if settings.FEATURES.get('AUTOMATIC_AUTH_FOR_TESTING'): urlpatterns += ( url(r'^auto_auth$', 'student.views.auto_auth'), )