From f3f4af808773078f3055ac56e3e0a81aceb79f4c Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Mon, 2 Dec 2013 11:55:01 -0500 Subject: [PATCH 1/2] settings.MITX_FEATURES => settings.FEATURES --- CHANGELOG.rst | 4 ++ cms/djangoapps/auth/authz.py | 4 +- cms/djangoapps/auth/tests/test_authz.py | 6 +- .../contentstore/tests/test_contentstore.py | 10 ++-- .../tests/test_course_settings.py | 4 +- .../contentstore/tests/test_request_event.py | 4 +- .../contentstore/tests/test_utils.py | 12 ++-- cms/djangoapps/contentstore/utils.py | 4 +- .../contentstore/views/component.py | 2 +- cms/djangoapps/contentstore/views/course.py | 6 +- cms/djangoapps/course_creators/admin.py | 4 +- .../course_creators/tests/test_admin.py | 6 +- .../course_creators/tests/test_views.py | 4 +- cms/envs/acceptance.py | 2 +- cms/envs/aws.py | 8 +-- cms/envs/common.py | 6 +- cms/envs/dev.py | 8 +-- cms/envs/dev_ike.py | 4 +- cms/envs/dev_shared_preview.py | 2 +- cms/envs/devstack.py | 2 +- cms/envs/test.py | 8 +-- cms/templates/index.html | 8 +-- cms/templates/widgets/qualaroo.html | 2 +- cms/templates/widgets/segment-io.html | 2 +- cms/urls.py | 4 +- common/djangoapps/edxmako/shortcuts.py | 4 +- common/djangoapps/edxmako/tests.py | 4 +- .../tests/test_openid_provider.py | 32 +++++------ .../external_auth/tests/test_shib.py | 14 ++--- .../external_auth/tests/test_ssl.py | 14 ++--- common/djangoapps/external_auth/views.py | 20 +++---- .../templates/static_content.html | 4 +- common/djangoapps/student/models.py | 2 +- .../student/tests/test_auto_auth.py | 10 ++-- .../student/tests/test_bulk_email_settings.py | 12 ++-- common/djangoapps/student/tests/test_login.py | 8 +-- common/djangoapps/student/tests/tests.py | 4 +- common/djangoapps/student/views.py | 26 ++++----- common/djangoapps/track/tests.py | 4 +- .../util/tests/test_submit_feedback.py | 4 +- common/djangoapps/util/views.py | 2 +- common/djangoapps/xmodule_modifiers.py | 4 +- common/lib/xmodule/xmodule/video_module.py | 2 +- docs/internal/development.md | 2 +- docs/internal/remote_gradebook.md | 2 +- lms/djangoapps/branding/__init__.py | 4 +- lms/djangoapps/branding/tests.py | 14 ++--- lms/djangoapps/branding/views.py | 8 +-- lms/djangoapps/bulk_email/models.py | 4 +- .../bulk_email/tests/test_course_optout.py | 4 +- lms/djangoapps/bulk_email/tests/test_email.py | 2 +- lms/djangoapps/bulk_email/tests/test_forms.py | 8 +-- .../bulk_email/tests/test_models.py | 4 +- lms/djangoapps/courseware/access.py | 8 +-- lms/djangoapps/courseware/masquerade.py | 2 +- lms/djangoapps/courseware/module_render.py | 4 +- lms/djangoapps/courseware/tabs.py | 8 +-- lms/djangoapps/courseware/tests/test_tabs.py | 14 ++--- .../courseware/tests/test_video_mongo.py | 4 +- .../courseware/tests/test_video_xml.py | 2 +- .../tests/test_view_authentication.py | 12 ++-- lms/djangoapps/courseware/tests/test_views.py | 4 +- lms/djangoapps/courseware/views.py | 14 ++--- .../django_comment_client/base/tests.py | 2 +- .../django_comment_client/forum/tests.py | 2 +- lms/djangoapps/instructor/hint_manager.py | 2 +- lms/djangoapps/instructor/tests/test_email.py | 14 ++--- .../instructor/tests/test_legacy_email.py | 10 ++-- .../instructor/views/instructor_dashboard.py | 4 +- lms/djangoapps/instructor/views/legacy.py | 14 ++--- lms/djangoapps/notes/utils.py | 4 +- .../shoppingcart/context_processor.py | 4 +- lms/djangoapps/shoppingcart/models.py | 4 +- .../tests/test_context_processor.py | 14 ++--- .../shoppingcart/tests/test_models.py | 4 +- lms/djangoapps/shoppingcart/urls.py | 4 +- lms/djangoapps/verify_student/models.py | 6 +- .../verify_student/tests/test_views.py | 2 +- lms/envs/acceptance.py | 14 ++--- lms/envs/aws.py | 8 +-- lms/envs/cms/acceptance.py | 2 +- lms/envs/cms/dev.py | 4 +- lms/envs/common.py | 12 ++-- lms/envs/dev.py | 56 +++++++++---------- lms/envs/dev_ike.py | 26 ++++----- lms/envs/dev_int.py | 2 +- lms/envs/devstack.py | 4 +- lms/envs/test.py | 24 ++++---- lms/templates/courseware/course_about.html | 8 +-- .../courseware/instructor_dashboard.html | 22 ++++---- lms/templates/dashboard.html | 2 +- .../discussion/_underscore_templates.html | 4 +- lms/templates/help_modal.html | 2 +- lms/templates/index.html | 2 +- .../instructor_dashboard_2/course_info.html | 2 +- .../instructor_dashboard_2/data_download.html | 6 +- .../instructor_dashboard_2/send_email.html | 2 +- .../instructor_dashboard_2/student_admin.html | 8 +-- lms/templates/login.html | 2 +- lms/templates/login_modal.html | 2 +- lms/templates/main.html | 2 +- lms/templates/navigation.html | 14 ++--- lms/templates/staff_problem_info.html | 2 +- lms/templates/widgets/segment-io.html | 2 +- lms/urls.py | 44 +++++++-------- 105 files changed, 396 insertions(+), 392 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4507bcccf9..a375086412 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 1a1f138cb5..a5d00e14c1 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 69050539cf..6bbb8d0a41 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 0aaf2dfb29..62c4d6b145 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 792b28fe4d..1801e7c8dc 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 0126de66c6..166187ee58 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 5311396f2f..514fd80278 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 0a2ecbd37b..cf4bffc503 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 269b603eff..0a34045687 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 5680be8077..61131fcc11 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 87e17fabfa..5eaa8c4ac3 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 aa293e008e..4d28f26399 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 95c50ffb76..dbd92365b7 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 afbdff7d3f..67ecfa5689 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 1b0c0ef648..8853ccf431 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 961a089a14..a8c293b57f 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 ddf1708c87..6d47e65f23 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 6e67f78f36..95ae33e328 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 119558ba05..ec488a68ba 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 e25f092c9a..fa41d5cef8 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 ef7133e0bd..5edea467d3 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 572f40a865..6d3627e254 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': ${_("New Course")} - % elif course_creator_status=='disallowed_for_this_site' and settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL',''): - ${_("Email staff to create course")} + % elif course_creator_status=='disallowed_for_this_site' and settings.FEATURES.get('STUDIO_REQUEST_EMAIL',''): + ${_("Email staff to create course")} % endif @@ -290,10 +290,10 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { - % 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',''):

${_('Can I create courses in Studio?')}

-

${_('In order to create courses in Studio, you must')} ${_("contact edX staff to help you create a course")}

+

${_('In order to create courses in Studio, you must')} ${_("contact edX staff to help you create a course")}

% endif diff --git a/cms/templates/widgets/qualaroo.html b/cms/templates/widgets/qualaroo.html index 04d10e08d1..1081c22c08 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'):