Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/auth/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/auth/tests/test_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_creator_group_not_enabled(self):

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.
Expand All @@ -42,7 +42,7 @@ def test_creator_group_enabled_but_empty(self):

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))

Expand Down Expand Up @@ -70,7 +70,7 @@ def test_add_user_not_active(self):

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))
Expand Down
10 changes: 5 additions & 5 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,31 +1506,31 @@ def test_create_course_with_bad_organization(self):

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()

Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/tests/test_course_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_update_and_fetch(self):
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")
Expand All @@ -127,7 +127,7 @@ def test_marketing_site_fetch(self):
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")
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/tests/test_request_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_post_answers_to_log(self):
{"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)
Expand All @@ -34,7 +34,7 @@ def test_get_answers_to_log(self):
{"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)
12 changes: 6 additions & 6 deletions cms/djangoapps/contentstore/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,33 @@ def about_page_test(self):
@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)
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/views/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/'
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/course_creators/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/course_creators/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def change_state_and_verify_email(state, is_creator):
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))
Expand Down Expand Up @@ -119,7 +119,7 @@ def check_admin_message_state(state, expect_sent_to_admin, expect_sent_to_user):
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.
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_change_permission(self):
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
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/course_creators/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_add_unrequested(self):
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))

Expand All @@ -60,7 +60,7 @@ def test_add_granted(self):
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))
Expand Down
2 changes: 1 addition & 1 deletion cms/envs/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def seed():
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
Expand Down
9 changes: 5 additions & 4 deletions cms/envs/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
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']

Expand Down Expand Up @@ -138,8 +138,9 @@
TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE)


for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items():
MITX_FEATURES[feature] = value
ENV_FEATURES = ENV_TOKENS.get('FEATURES', ENV_TOKENS.get('MITX_FEATURES', {}))
for feature, value in ENV_FEATURES.items():
FEATURES[feature] = value

LOGGING = get_logger_config(LOG_DIR,
logging_env=ENV_TOKENS['LOGGING_ENV'],
Expand All @@ -164,7 +165,7 @@
# 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 == "":
Expand Down
6 changes: 3 additions & 3 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -14,7 +14,7 @@
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.
"""
Expand All @@ -36,7 +36,7 @@

############################ FEATURE CONFIGURATION #############################

MITX_FEATURES = {
FEATURES = {
'USE_DJANGO_PIPELINE': True,

'GITHUB_PUSH': False,
Expand Down
8 changes: 4 additions & 4 deletions cms/envs/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}

LMS_BASE = "localhost:8000"
MITX_FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000"
FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000"

REPOS = {
'edx4edx': {
Expand Down Expand Up @@ -178,10 +178,10 @@
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 ##################################

Expand All @@ -190,7 +190,7 @@
import os
SEGMENT_IO_KEY = os.environ.get('SEGMENT_IO_KEY')
if SEGMENT_IO_KEY:
MITX_FEATURES['SEGMENT_IO'] = True
FEATURES['SEGMENT_IO'] = True


#####################################################################
Expand Down
Loading