Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c24a9198
Commit
c24a9198
authored
Nov 06, 2017
by
Jeremy Bowman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PLAT-1774 Move x_module monkey-patching
parent
0255592c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
25 deletions
+55
-25
cms/djangoapps/xblock_config/apps.py
+26
-0
cms/envs/common.py
+1
-1
cms/startup.py
+0
-11
common/lib/xmodule/xmodule/x_module.py
+2
-2
lms/djangoapps/lms_xblock/apps.py
+25
-0
lms/envs/common.py
+1
-1
lms/startup.py
+0
-10
No files found.
cms/djangoapps/xblock_config/apps.py
0 → 100644
View file @
c24a9198
"""
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
cms/envs/common.py
View file @
c24a9198
...
...
@@ -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'
,
...
...
cms/startup.py
View file @
c24a9198
...
...
@@ -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
():
"""
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
c24a9198
...
...
@@ -1270,7 +1270,7 @@ class ConfigurableFragmentWrapper(object):
# the Runtime part of its interface. This function mostly matches the
# Runtime.handler_url interface.
#
# The monkey-patching happens in
(lms|cms)/startup
.py
# The monkey-patching happens in
cms/djangoapps/xblock_config/apps.py and lms/djangoapps/lms_xblock/apps
.py
def
descriptor_global_handler_url
(
block
,
handler_name
,
suffix
=
''
,
query
=
''
,
thirdparty
=
False
):
# pylint: disable=unused-argument
"""
See :meth:`xblock.runtime.Runtime.handler_url`.
...
...
@@ -1282,7 +1282,7 @@ def descriptor_global_handler_url(block, handler_name, suffix='', query='', thir
# we can refactor modulestore to split out the FieldData half of its interface from
# the Runtime part of its interface. This function matches the Runtime.local_resource_url interface
#
# The monkey-patching happens in
(lms|cms)/startup
.py
# The monkey-patching happens in
cms/djangoapps/xblock_config/apps.py and lms/djangoapps/lms_xblock/apps
.py
def
descriptor_global_local_resource_url
(
block
,
uri
):
# pylint: disable=invalid-name, unused-argument
"""
See :meth:`xblock.runtime.Runtime.local_resource_url`.
...
...
lms/djangoapps/lms_xblock/apps.py
0 → 100644
View file @
c24a9198
"""
lms_xblock Application Configuration
"""
from
__future__
import
absolute_import
from
django.apps
import
AppConfig
import
xmodule.x_module
from
.runtime
import
handler_url
,
local_resource_url
class
LMSXBlockConfig
(
AppConfig
):
"""
Default configuration for the "lms.djangoapps.lms_xblock" Django application.
"""
name
=
u'lms.djangoapps.lms_xblock'
verbose_name
=
u'LMS XBlock'
def
ready
(
self
):
# In order to allow modules 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
=
handler_url
xmodule
.
x_module
.
descriptor_global_local_resource_url
=
local_resource_url
lms/envs/common.py
View file @
c24a9198
...
...
@@ -2218,7 +2218,7 @@ INSTALLED_APPS = [
# Surveys
'survey'
,
'lms.djangoapps.lms_xblock'
,
'lms.djangoapps.lms_xblock
.apps.LMSXBlockConfig
'
,
# Course data caching
'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'
,
...
...
lms/startup.py
View file @
c24a9198
...
...
@@ -15,9 +15,6 @@ from openedx.core.lib.django_startup import autostartup
from
openedx.core.djangoapps.monkey_patch
import
django_db_models_options
import
xmodule.x_module
import
lms_xblock.runtime
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -36,13 +33,6 @@ def run():
add_mimetypes
()
# In order to allow modules 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
=
lms_xblock
.
runtime
.
handler_url
xmodule
.
x_module
.
descriptor_global_local_resource_url
=
lms_xblock
.
runtime
.
local_resource_url
def
add_mimetypes
():
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment