Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
problem-builder
Commits
7e54dd78
Commit
7e54dd78
authored
Jun 03, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
3200bd41
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
mentoring/answer.py
+1
-1
mentoring/dataexport.py
+0
-1
mentoring/light_children.py
+4
-4
mentoring/utils.py
+5
-0
No files found.
mentoring/answer.py
View file @
7e54dd78
...
...
@@ -137,7 +137,7 @@ class AnswerBlock(LightChild):
name
=
self
.
name
# Consistency check - we should have a name by now
if
not
name
:
raise
ValueError
,
'AnswerBlock.name field need to be set to a non-null/empty value'
raise
ValueError
(
'AnswerBlock.name field need to be set to a non-null/empty value'
)
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
...
...
mentoring/dataexport.py
View file @
7e54dd78
...
...
@@ -96,4 +96,3 @@ class MentoringDataExportBlock(XBlock):
if
row
:
yield
list2csv
(
row
)
mentoring/light_children.py
View file @
7e54dd78
...
...
@@ -44,7 +44,7 @@ try:
from
xmodule_modifiers
import
replace_jump_to_id_urls
except
:
# 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
...
...
@@ -142,7 +142,7 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
frag
=
getattr
(
child
,
view_name
)(
context
)
frag
.
content
=
u'<div class="xblock-light-child" name="{}" data-type="{}">{}</div>'
.
format
(
child
.
name
,
child
.
__class__
.
__name__
,
frag
.
content
)
child
.
name
,
child
.
__class__
.
__name__
,
frag
.
content
)
return
frag
def
get_children_fragment
(
self
,
context
,
view_name
=
'student_view'
,
instance_of
=
None
,
...
...
@@ -298,7 +298,7 @@ class LightChild(Plugin, LightChildrenMixin):
name
=
self
.
name
if
not
name
:
raise
ValueError
,
'LightChild.name field need to be set to a non-null/empty value'
raise
ValueError
(
'LightChild.name field need to be set to a non-null/empty value'
)
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
course_id
=
serialize_opaque_key
(
self
.
xmodule_runtime
.
course_id
)
...
...
@@ -349,7 +349,7 @@ class Integer(LightChildField):
def
__set__
(
self
,
instance
,
value
):
try
:
self
.
data
[
instance
]
=
int
(
value
)
except
(
TypeError
,
ValueError
):
# not an integer
except
(
TypeError
,
ValueError
):
# not an integer
self
.
data
[
instance
]
=
0
...
...
mentoring/utils.py
View file @
7e54dd78
...
...
@@ -47,6 +47,7 @@ def load_resource(resource_path):
resource_content
=
pkg_resources
.
resource_string
(
__name__
,
resource_path
)
return
unicode
(
resource_content
)
def
render_template
(
template_path
,
context
=
{}):
"""
Evaluate a template by resource path, applying the provided context
...
...
@@ -55,6 +56,7 @@ def render_template(template_path, context={}):
template
=
Template
(
template_str
)
return
template
.
render
(
Context
(
context
))
def
list2csv
(
row
):
"""
Convert a list to a CSV string (single row)
...
...
@@ -65,6 +67,7 @@ def list2csv(row):
f
.
seek
(
0
)
return
f
.
read
()
def
get_scenarios_from_path
(
scenarios_path
,
include_identifier
=
False
):
"""
Returns an array of (title, xmlcontent) from files contained in a specified directory,
...
...
@@ -88,12 +91,14 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False):
return
scenarios
def
load_scenarios_from_path
(
scenarios_path
):
"""
Load all xml files contained in a specified directory, as workbench scenarios
"""
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.
...
...
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