Minor cleanup of Studio settings: removing extra indirection, and advanced components list
This commit is contained in:
@@ -14,7 +14,6 @@ from django.utils.timezone import UTC
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.views.component import ADVANCED_COMPONENT_POLICY_KEY
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
from models.settings.course_metadata import CourseMetadata
|
||||
from models.settings.encoder import CourseSettingsEncoder
|
||||
@@ -910,14 +909,14 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
|
||||
# Now enable student notes and verify that the "My Notes" tab has been added
|
||||
self.client.ajax_post(self.course_setting_url, {
|
||||
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["notes"]}
|
||||
'advanced_modules': {"value": ["notes"]}
|
||||
})
|
||||
course = modulestore().get_course(self.course.id)
|
||||
self.assertIn(self.notes_tab, course.tabs)
|
||||
|
||||
# Disable student notes and verify that the "My Notes" tab is gone
|
||||
self.client.ajax_post(self.course_setting_url, {
|
||||
ADVANCED_COMPONENT_POLICY_KEY: {"value": [""]}
|
||||
'advanced_modules': {"value": [""]}
|
||||
})
|
||||
course = modulestore().get_course(self.course.id)
|
||||
self.assertNotIn(self.notes_tab, course.tabs)
|
||||
@@ -925,7 +924,7 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
def test_advanced_components_munge_tabs_validation_failure(self):
|
||||
with patch('contentstore.views.course._refresh_course_tabs', side_effect=InvalidTabsException):
|
||||
resp = self.client.ajax_post(self.course_setting_url, {
|
||||
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["notes"]}
|
||||
'advanced_modules': {"value": ["notes"]}
|
||||
})
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
|
||||
@@ -949,7 +948,7 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
self.course.tabs = tab_list
|
||||
modulestore().update_item(self.course, self.user.id)
|
||||
self.client.ajax_post(self.course_setting_url, {
|
||||
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["notes"]}
|
||||
'advanced_modules': {"value": ["notes"]}
|
||||
})
|
||||
course = modulestore().get_course(self.course.id)
|
||||
tab_list.append(self.notes_tab)
|
||||
|
||||
@@ -31,31 +31,19 @@ from django.utils.translation import ugettext as _
|
||||
from models.settings.course_grading import CourseGradingModel
|
||||
|
||||
__all__ = [
|
||||
'ADVANCED_COMPONENT_POLICY_KEY',
|
||||
'container_handler',
|
||||
'component_handler'
|
||||
]
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# NOTE: it is assumed that this list is disjoint from ADVANCED_COMPONENT_TYPES
|
||||
# NOTE: This list is disjoint from ADVANCED_COMPONENT_TYPES
|
||||
COMPONENT_TYPES = ['discussion', 'html', 'problem', 'video']
|
||||
|
||||
# Constants for determining if these components should be enabled for this course
|
||||
SPLIT_TEST_COMPONENT_TYPE = 'split_test'
|
||||
NOTE_COMPONENT_TYPES = ['notes']
|
||||
|
||||
if settings.FEATURES.get('ALLOW_ALL_ADVANCED_COMPONENTS'):
|
||||
ADVANCED_COMPONENT_TYPES = sorted(set(name for name, class_ in XBlock.load_classes()) - set(COMPONENT_TYPES))
|
||||
else:
|
||||
ADVANCED_COMPONENT_TYPES = settings.ADVANCED_COMPONENT_TYPES
|
||||
|
||||
ADVANCED_COMPONENT_CATEGORY = 'advanced'
|
||||
ADVANCED_COMPONENT_POLICY_KEY = 'advanced_modules'
|
||||
ADVANCED_COMPONENT_TYPES = sorted(set(name for name, class_ in XBlock.load_classes()) - set(COMPONENT_TYPES))
|
||||
|
||||
ADVANCED_PROBLEM_TYPES = settings.ADVANCED_PROBLEM_TYPES
|
||||
|
||||
|
||||
CONTAINER_TEMPLATES = [
|
||||
"basic-modal", "modal-button", "edit-xblock-modal",
|
||||
"editor-mode-button", "upload-dialog",
|
||||
|
||||
@@ -24,7 +24,6 @@ from opaque_keys.edx.locations import Location
|
||||
|
||||
from .component import (
|
||||
ADVANCED_COMPONENT_TYPES,
|
||||
SPLIT_TEST_COMPONENT_TYPE,
|
||||
)
|
||||
from .item import create_xblock_info
|
||||
from .library import LIBRARIES_ENABLED
|
||||
@@ -1598,8 +1597,8 @@ def are_content_experiments_enabled(course):
|
||||
Returns True if content experiments have been enabled for the course.
|
||||
"""
|
||||
return (
|
||||
SPLIT_TEST_COMPONENT_TYPE in ADVANCED_COMPONENT_TYPES and
|
||||
SPLIT_TEST_COMPONENT_TYPE in course.advanced_modules
|
||||
'split_test' in ADVANCED_COMPONENT_TYPES and
|
||||
'split_test' in course.advanced_modules
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ Group Configuration Tests.
|
||||
import json
|
||||
from mock import patch
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.views.component import SPLIT_TEST_COMPONENT_TYPE
|
||||
from contentstore.course_group_config import GroupConfiguration
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from xmodule.partitions.partitions import Group, UserPartition
|
||||
@@ -229,8 +228,8 @@ class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurations
|
||||
]
|
||||
self.save_course()
|
||||
|
||||
if SPLIT_TEST_COMPONENT_TYPE not in self.course.advanced_modules:
|
||||
self.course.advanced_modules.append(SPLIT_TEST_COMPONENT_TYPE)
|
||||
if 'split_test' not in self.course.advanced_modules:
|
||||
self.course.advanced_modules.append('split_test')
|
||||
self.store.update_item(self.course, self.user.id)
|
||||
|
||||
response = self.client.get(self._url())
|
||||
|
||||
@@ -330,7 +330,6 @@ ADVANCED_SECURITY_CONFIG = ENV_TOKENS.get('ADVANCED_SECURITY_CONFIG', {})
|
||||
|
||||
################ ADVANCED COMPONENT/PROBLEM TYPES ###############
|
||||
|
||||
ADVANCED_COMPONENT_TYPES = ENV_TOKENS.get('ADVANCED_COMPONENT_TYPES', ADVANCED_COMPONENT_TYPES)
|
||||
ADVANCED_PROBLEM_TYPES = ENV_TOKENS.get('ADVANCED_PROBLEM_TYPES', ADVANCED_PROBLEM_TYPES)
|
||||
DEPRECATED_ADVANCED_COMPONENT_TYPES = ENV_TOKENS.get(
|
||||
'DEPRECATED_ADVANCED_COMPONENT_TYPES', DEPRECATED_ADVANCED_COMPONENT_TYPES
|
||||
|
||||
@@ -18,6 +18,21 @@ Longer TODO:
|
||||
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.
|
||||
|
||||
When refering to XBlocks, we use the entry-point name. For example,
|
||||
| setup(
|
||||
| name='xblock-foobar',
|
||||
| version='0.1',
|
||||
| packages=[
|
||||
| 'foobar_xblock',
|
||||
| ],
|
||||
| entry_points={
|
||||
| 'xblock.v1': [
|
||||
| 'foobar-block = foobar_xblock:FoobarBlock',
|
||||
| # ^^^^^^^^^^^^ This is the one you want.
|
||||
| ]
|
||||
| },
|
||||
| )
|
||||
"""
|
||||
|
||||
# We intentionally define lots of variables that aren't used, and
|
||||
@@ -92,10 +107,6 @@ FEATURES = {
|
||||
# whether to use password policy enforcement or not
|
||||
'ENFORCE_PASSWORD_POLICY': False,
|
||||
|
||||
# If set to True, Studio won't restrict the set of advanced components
|
||||
# to just those pre-approved by edX
|
||||
'ALLOW_ALL_ADVANCED_COMPONENTS': False,
|
||||
|
||||
# Turn off account locking if failed login attempts exceeds a limit
|
||||
'ENABLE_MAX_FAILED_LOGIN_ATTEMPTS': False,
|
||||
|
||||
@@ -357,9 +368,6 @@ XBLOCK_MIXINS = (
|
||||
AuthoringMixin,
|
||||
)
|
||||
|
||||
# Allow any XBlock in Studio
|
||||
# You should also enable the ALLOW_ALL_ADVANCED_COMPONENTS feature flag, so that
|
||||
# xblocks can be added via advanced settings
|
||||
XBLOCK_SELECT_FUNCTION = prefer_xmodules
|
||||
|
||||
############################ Modulestore Configuration ################################
|
||||
@@ -982,75 +990,6 @@ ENTRANCE_EXAM_MIN_SCORE_PCT = 50
|
||||
### Default language for a new course
|
||||
DEFAULT_COURSE_LANGUAGE = "en"
|
||||
|
||||
|
||||
################ ADVANCED_COMPONENT_TYPES ###############
|
||||
|
||||
# These strings are entry-point names from the setup.py of the XBlock.
|
||||
# For example:
|
||||
#
|
||||
# setup(
|
||||
# name='xblock-foobar',
|
||||
# version='0.1',
|
||||
# packages=[
|
||||
# 'foobar_xblock',
|
||||
# ],
|
||||
# entry_points={
|
||||
# 'xblock.v1': [
|
||||
# 'foobar-block = foobar_xblock:FoobarBlock',
|
||||
# # ^^^^^^^^^^^^ This is the one you want.
|
||||
# ]
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# To use this block, add 'foobar-block' to the ADVANCED_COMPONENT_TYPES list.
|
||||
|
||||
ADVANCED_COMPONENT_TYPES = [
|
||||
'annotatable',
|
||||
'textannotation', # module for annotating text (with annotation table)
|
||||
'videoannotation', # module for annotating video (with annotation table)
|
||||
'imageannotation', # module for annotating image (with annotation table)
|
||||
'word_cloud',
|
||||
'lti',
|
||||
'lti_consumer',
|
||||
'library_content',
|
||||
'edx_sga',
|
||||
'problem-builder',
|
||||
'pb-dashboard',
|
||||
'poll',
|
||||
'survey',
|
||||
'activetable',
|
||||
'vectordraw',
|
||||
# Some of the XBlocks from pmitros repos are sometimes prototypes.
|
||||
# Use with caution.
|
||||
'concept', # Concept mapper. See https://github.com/pmitros/ConceptXBlock
|
||||
'done', # Lets students mark things as done. See https://github.com/pmitros/DoneXBlock
|
||||
'audio', # Embed an audio file. See https://github.com/pmitros/AudioXBlock
|
||||
'recommender', # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course.
|
||||
'profile', # Prototype user profile XBlock. Used to test XBlock parameter passing. See https://github.com/pmitros/ProfileXBlock
|
||||
'rate', # Allows up-down voting of course content. See https://github.com/pmitros/RateXBlock
|
||||
|
||||
'split_test',
|
||||
'notes',
|
||||
'schoolyourself_review',
|
||||
'schoolyourself_lesson',
|
||||
# Office Mix
|
||||
'officemix',
|
||||
|
||||
# Google Drive embedded components. These XBlocks allow one to
|
||||
# embed public google drive documents and calendars within edX units
|
||||
'google-document',
|
||||
'google-calendar',
|
||||
|
||||
# Oppia block
|
||||
'oppia',
|
||||
|
||||
# In-course reverification checkpoint
|
||||
'edx-reverification-block',
|
||||
|
||||
# Peer instruction tool
|
||||
'ubcpi',
|
||||
]
|
||||
|
||||
# Adding components in this list will disable the creation of new problem for
|
||||
# those components in Studio. Existing problems will work fine and one can edit
|
||||
# them in Studio.
|
||||
@@ -1058,9 +997,7 @@ DEPRECATED_ADVANCED_COMPONENT_TYPES = []
|
||||
|
||||
# Specify XBlocks that should be treated as advanced problems. Each entry is a
|
||||
# dict:
|
||||
# 'component': the entry-point name of the XBlock. See the comment for
|
||||
# ADVANCED_COMPONENT_TYPES for details of where to find this
|
||||
# name.
|
||||
# 'component': the entry-point name of the XBlock.
|
||||
# 'boilerplate_name': an optional YAML template to be used. Specify as
|
||||
# None to omit.
|
||||
#
|
||||
|
||||
@@ -55,11 +55,6 @@ DJFS = {
|
||||
'url_root': '/static/djpyfs',
|
||||
}
|
||||
|
||||
############################# ADVANCED COMPONENTS #############################
|
||||
|
||||
# Make it easier to test advanced components in local dev
|
||||
FEATURES['ALLOW_ALL_ADVANCED_COMPONENTS'] = True
|
||||
|
||||
################################# CELERY ######################################
|
||||
|
||||
# By default don't use a worker, execute tasks as if they were local functions
|
||||
|
||||
Reference in New Issue
Block a user