PLAT-1774 Move x_module monkey-patching
This commit is contained in:
26
cms/djangoapps/xblock_config/apps.py
Normal file
26
cms/djangoapps/xblock_config/apps.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
xblock_config Application Configuration
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
import cms.lib.xblock.runtime
|
||||
import xmodule.x_module
|
||||
from openedx.core.lib.xblock_utils import xblock_local_resource_url
|
||||
|
||||
|
||||
class XBlockConfig(AppConfig):
|
||||
"""
|
||||
Default configuration for the "xblock_config" Django application.
|
||||
"""
|
||||
name = u'xblock_config'
|
||||
verbose_name = u'XBlock Configuration'
|
||||
|
||||
def ready(self):
|
||||
# In order to allow descriptors to use a handler url, we need to
|
||||
# monkey-patch the x_module library.
|
||||
# TODO: Remove this code when Runtimes are no longer created by modulestores
|
||||
# https://openedx.atlassian.net/wiki/display/PLAT/Convert+from+Storage-centric+runtimes+to+Application-centric+runtimes
|
||||
xmodule.x_module.descriptor_global_handler_url = cms.lib.xblock.runtime.handler_url
|
||||
xmodule.x_module.descriptor_global_local_resource_url = xblock_local_resource_url
|
||||
@@ -955,7 +955,7 @@ INSTALLED_APPS = [
|
||||
'openedx.core.djangoapps.external_auth',
|
||||
'student', # misleading name due to sharing with lms
|
||||
'openedx.core.djangoapps.course_groups', # not used in cms (yet), but tests run
|
||||
'xblock_config',
|
||||
'xblock_config.apps.XBlockConfig',
|
||||
|
||||
# Maintenance tools
|
||||
'maintenance',
|
||||
|
||||
@@ -5,8 +5,6 @@ Module with code executed during Studio startup
|
||||
import django
|
||||
from django.conf import settings
|
||||
|
||||
import cms.lib.xblock.runtime
|
||||
import xmodule.x_module
|
||||
from openedx.core.djangoapps.monkey_patch import django_db_models_options
|
||||
from openedx.core.lib.django_startup import autostartup
|
||||
|
||||
@@ -14,8 +12,6 @@ from openedx.core.lib.django_startup import autostartup
|
||||
|
||||
settings.INSTALLED_APPS # pylint: disable=pointless-statement
|
||||
|
||||
from openedx.core.lib.xblock_utils import xblock_local_resource_url
|
||||
|
||||
|
||||
def run():
|
||||
"""
|
||||
@@ -32,13 +28,6 @@ def run():
|
||||
|
||||
add_mimetypes()
|
||||
|
||||
# In order to allow descriptors to use a handler url, we need to
|
||||
# monkey-patch the x_module library.
|
||||
# TODO: Remove this code when Runtimes are no longer created by modulestores
|
||||
# https://openedx.atlassian.net/wiki/display/PLAT/Convert+from+Storage-centric+runtimes+to+Application-centric+runtimes
|
||||
xmodule.x_module.descriptor_global_handler_url = cms.lib.xblock.runtime.handler_url
|
||||
xmodule.x_module.descriptor_global_local_resource_url = xblock_local_resource_url
|
||||
|
||||
|
||||
def add_mimetypes():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user