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
38de05c7
Commit
38de05c7
authored
Sep 06, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include mixins in advanced component class loading and preview modules
parent
0099ee09
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
cms/djangoapps/contentstore/views/component.py
+12
-2
cms/djangoapps/contentstore/views/preview.py
+2
-0
lms/djangoapps/open_ended_grading/tests.py
+2
-1
No files found.
cms/djangoapps/contentstore/views/component.py
View file @
38de05c7
...
...
@@ -30,6 +30,7 @@ from .requests import _xmodule_recurse
from
.access
import
has_access
from
xmodule.x_module
import
XModuleDescriptor
from
xblock.plugin
import
PluginMissingError
from
xblock.runtime
import
Mixologist
__all__
=
[
'OPEN_ENDED_COMPONENT_TYPES'
,
'ADVANCED_COMPONENT_POLICY_KEY'
,
...
...
@@ -137,6 +138,15 @@ def edit_subsection(request, location):
)
def
load_mixed_class
(
category
):
"""
Load an XBlock by category name, and apply all defined mixins
"""
component_class
=
XModuleDescriptor
.
load_class
(
category
)
mixologist
=
Mixologist
(
settings
.
XBLOCK_MIXINS
)
return
mixologist
.
mix
(
component_class
)
@login_required
def
edit_unit
(
request
,
location
):
"""
...
...
@@ -165,7 +175,7 @@ def edit_unit(request, location):
component_templates
=
defaultdict
(
list
)
for
category
in
COMPONENT_TYPES
:
component_class
=
XModuleDescriptor
.
loa
d_class
(
category
)
component_class
=
load_mixe
d_class
(
category
)
# add the default template
# TODO: Once mixins are defined per-application, rather than per-runtime,
# this should use a cms mixed-in class. (cpennington)
...
...
@@ -203,7 +213,7 @@ def edit_unit(request, location):
# class? i.e., can an advanced have more than one entry in the
# menu? one for default and others for prefilled boilerplates?
try
:
component_class
=
XModuleDescriptor
.
loa
d_class
(
category
)
component_class
=
load_mixe
d_class
(
category
)
component_templates
[
'advanced'
]
.
append
((
component_class
.
display_name
.
default
or
category
,
...
...
cms/djangoapps/contentstore/views/preview.py
View file @
38de05c7
...
...
@@ -2,6 +2,7 @@ import logging
import
sys
from
functools
import
partial
from
django.conf
import
settings
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseBadRequest
,
HttpResponseForbidden
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.decorators
import
login_required
...
...
@@ -116,6 +117,7 @@ def preview_module_system(request, preview_id, descriptor):
user
=
request
.
user
,
xblock_field_data
=
preview_field_data
,
can_execute_unsafe_code
=
(
lambda
:
can_execute_unsafe_code
(
course_id
)),
mixins
=
settings
.
XBLOCK_MIXINS
,
)
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
38de05c7
...
...
@@ -169,7 +169,8 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
replace_urls
=
None
,
xblock_field_data
=
lambda
d
:
d
.
_field_data
,
s3_interface
=
test_util_open_ended
.
S3_INTERFACE
,
open_ended_grading_interface
=
test_util_open_ended
.
OPEN_ENDED_GRADING_INTERFACE
open_ended_grading_interface
=
test_util_open_ended
.
OPEN_ENDED_GRADING_INTERFACE
,
mixins
=
settings
.
XBLOCK_MIXINS
,
)
self
.
descriptor
=
peer_grading_module
.
PeerGradingDescriptor
(
self
.
system
,
field_data
,
ScopeIds
(
None
,
None
,
None
,
None
))
self
.
peer_module
=
self
.
descriptor
.
xmodule
(
self
.
system
)
...
...
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