Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-mentoring
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
OpenEdx
xblock-mentoring
Commits
257c6162
Commit
257c6162
authored
Sep 13, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8 from open-craft/opaque-keys-follow-up-gse
Remove serialize_opaque_key
parents
4d1cce78
c180f007
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
27 deletions
+4
-27
mentoring/answer.py
+2
-3
mentoring/light_children.py
+2
-2
mentoring/utils.py
+0
-22
No files found.
mentoring/answer.py
View file @
257c6162
...
@@ -31,8 +31,7 @@ from xblock.fragment import Fragment
...
@@ -31,8 +31,7 @@ from xblock.fragment import Fragment
from
.light_children
import
LightChild
,
Boolean
,
Scope
,
String
from
.light_children
import
LightChild
,
Boolean
,
Scope
,
String
from
.models
import
Answer
from
.models
import
Answer
from
.utils
import
render_template
,
serialize_opaque_key
from
.utils
import
render_template
# Globals ###########################################################
# Globals ###########################################################
...
@@ -134,7 +133,7 @@ class AnswerBlock(LightChild):
...
@@ -134,7 +133,7 @@ class AnswerBlock(LightChild):
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
course_id
=
se
rialize_opaque_key
(
self
.
xmodule_runtime
.
course_id
)
course_id
=
se
lf
.
xmodule_runtime
.
course_id
answer_data
,
created
=
Answer
.
objects
.
get_or_create
(
answer_data
,
created
=
Answer
.
objects
.
get_or_create
(
student_id
=
student_id
,
student_id
=
student_id
,
...
...
mentoring/light_children.py
View file @
257c6162
...
@@ -40,7 +40,7 @@ except:
...
@@ -40,7 +40,7 @@ except:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
replace_jump_to_id_urls
=
lambda
a
,
b
,
c
,
d
,
frag
,
f
:
frag
replace_jump_to_id_urls
=
lambda
a
,
b
,
c
,
d
,
frag
,
f
:
frag
from
.utils
import
serialize_opaque_key
,
XBlockWithChildrenFragmentsMixin
from
.utils
import
XBlockWithChildrenFragmentsMixin
# Globals ###########################################################
# Globals ###########################################################
...
@@ -179,7 +179,7 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
...
@@ -179,7 +179,7 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
"""
"""
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
try
:
try
:
course_id
=
se
rialize_opaque_key
(
self
.
xmodule_runtime
.
course_id
)
course_id
=
se
lf
.
xmodule_runtime
.
course_id
except
AttributeError
:
except
AttributeError
:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
course_id
=
'sample-course'
course_id
=
'sample-course'
...
...
mentoring/utils.py
View file @
257c6162
...
@@ -82,28 +82,6 @@ def load_scenarios_from_path(scenarios_path):
...
@@ -82,28 +82,6 @@ def load_scenarios_from_path(scenarios_path):
"""
"""
return
get_scenarios_from_path
(
scenarios_path
,
include_identifier
=
True
)
return
get_scenarios_from_path
(
scenarios_path
,
include_identifier
=
True
)
def
serialize_opaque_key
(
key
):
"""
Gracefully handle opaque keys, both before and after the transition.
https://github.com/edx/edx-platform/wiki/Opaque-Keys
From https://github.com/edx/edx-ora2/pull/330
Currently uses `to_deprecated_string()` to ensure that new keys
are backwards-compatible with keys we store in ORA2 database models.
Args:
key (unicode or OpaqueKey subclass): The key to serialize.
Returns:
unicode
"""
if
hasattr
(
key
,
'to_deprecated_string'
):
return
key
.
to_deprecated_string
()
else
:
return
unicode
(
key
)
# Classes ###########################################################
# Classes ###########################################################
...
...
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