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
87aa71c4
Commit
87aa71c4
authored
Jan 29, 2014
by
jorr-at-google
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2309 from edx/jorr/feature/use-xblock-publish-api
Use the publish() api from xblock.runtime.Runtime
parents
c712668b
58c76afa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
14 deletions
+22
-14
common/lib/xmodule/xmodule/capa_base.py
+8
-5
common/lib/xmodule/xmodule/lti_module.py
+2
-1
common/lib/xmodule/xmodule/x_module.py
+10
-6
lms/djangoapps/courseware/module_render.py
+1
-1
requirements/edx/github.txt
+1
-1
No files found.
common/lib/xmodule/xmodule/capa_base.py
View file @
87aa71c4
...
...
@@ -838,11 +838,14 @@ class CapaMixin(CapaFields):
Publishes the student's current grade to the system as an event
"""
score
=
self
.
lcp
.
get_score
()
self
.
runtime
.
publish
({
'event_name'
:
'grade'
,
'value'
:
score
[
'score'
],
'max_value'
:
score
[
'total'
],
})
self
.
runtime
.
publish
(
self
,
{
'event_name'
:
'grade'
,
'value'
:
score
[
'score'
],
'max_value'
:
score
[
'total'
],
}
)
return
{
'grade'
:
score
[
'score'
],
'max_grade'
:
score
[
'total'
]}
...
...
common/lib/xmodule/xmodule/lti_module.py
View file @
87aa71c4
...
...
@@ -510,7 +510,8 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
if
action
==
'replaceResultRequest'
:
self
.
system
.
publish
(
event
=
{
self
,
{
'event_name'
:
'grade'
,
'value'
:
score
*
self
.
max_score
(),
'max_value'
:
self
.
max_score
(),
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
87aa71c4
...
...
@@ -988,12 +988,15 @@ class DescriptorSystem(ConfigurableFragmentWrapper, Runtime): # pylint: disable
# global function that the application can override.
return
descriptor_global_handler_url
(
block
,
handler_name
,
suffix
,
query
,
thirdparty
)
def
resource
s
_url
(
self
,
resource
):
def
resource_url
(
self
,
resource
):
raise
NotImplementedError
(
"edX Platform doesn't currently implement XBlock resource urls"
)
def
local_resource_url
(
self
,
block
,
uri
):
raise
NotImplementedError
(
"edX Platform doesn't currently implement XBlock resource urls"
)
def
publish
(
self
,
block
,
event
):
raise
NotImplementedError
(
"edX Platform doesn't currently implement XBlock publish"
)
class
XMLParsingSystem
(
DescriptorSystem
):
def
__init__
(
self
,
process_xml
,
**
kwargs
):
...
...
@@ -1101,10 +1104,8 @@ class ModuleSystem(ConfigurableFragmentWrapper, Runtime): # pylint: disable=abs
self
.
course_id
=
course_id
self
.
user_is_staff
=
user
is
not
None
and
user
.
is_staff
if
publish
is
None
:
publish
=
lambda
e
:
None
self
.
publish
=
publish
if
publish
:
self
.
publish
=
publish
self
.
open_ended_grading_interface
=
open_ended_grading_interface
self
.
s3_interface
=
s3_interface
...
...
@@ -1143,12 +1144,15 @@ class ModuleSystem(ConfigurableFragmentWrapper, Runtime): # pylint: disable=abs
def
get_block
(
self
,
block_id
):
raise
NotImplementedError
(
"XModules must use get_module to load other modules"
)
def
resource
s
_url
(
self
,
resource
):
def
resource_url
(
self
,
resource
):
raise
NotImplementedError
(
"edX Platform doesn't currently implement XBlock resource urls"
)
def
local_resource_url
(
self
,
block
,
uri
):
raise
NotImplementedError
(
"edX Platform doesn't currently implement XBlock resource urls"
)
def
publish
(
self
,
block
,
event
):
pass
class
DoNothingCache
(
object
):
"""A duck-compatible object to use in ModuleSystem when there's no cache."""
...
...
lms/djangoapps/courseware/module_render.py
View file @
87aa71c4
...
...
@@ -291,7 +291,7 @@ def get_module_for_descriptor_internal(user, descriptor, field_data_cache, cours
position
,
wrap_xmodule_display
,
grade_bucket_type
,
static_asset_path
)
def
publish
(
event
,
custom_user
=
None
):
def
publish
(
block
,
event
,
custom_user
=
None
):
"""A function that allows XModules to publish events. This only supports grade changes right now."""
if
event
.
get
(
'event_name'
)
!=
'grade'
:
return
...
...
requirements/edx/github.txt
View file @
87aa71c4
...
...
@@ -15,7 +15,7 @@
-e git+https://github.com/eventbrite/zendesk.git@d53fe0e81b623f084e91776bcf6369f8b7b63879#egg=zendesk
# Our libraries:
-e git+https://github.com/edx/XBlock.git@
a1a3e76b269d15b7bbd11976d8aef63e1db6c4c2
#egg=XBlock
-e git+https://github.com/edx/XBlock.git@
de92d3bf798699a6bbd06b54012ef15934c41ac0
#egg=XBlock
-e git+https://github.com/edx/codejail.git@e3d98f9455#egg=codejail
-e git+https://github.com/edx/diff-cover.git@v0.2.9#egg=diff_cover
-e git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool
...
...
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