Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
246b8945
Commit
246b8945
authored
Dec 16, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serialize prompts.
parent
4ccd5860
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
openassessment/xblock/xml.py
+6
-10
No files found.
openassessment/xblock/xml.py
View file @
246b8945
...
...
@@ -168,7 +168,7 @@ def _serialize_criteria(criteria_root, criteria_list):
_serialize_options
(
criterion_el
,
options_list
)
def
serialize_rubric
(
rubric_root
,
oa_block
,
include_prompt
=
False
):
def
serialize_rubric
(
rubric_root
,
oa_block
):
"""
Serialize a rubric dictionary as XML, adding children to the XML
with root node `rubric_root`.
...
...
@@ -182,17 +182,9 @@ def serialize_rubric(rubric_root, oa_block, include_prompt=False):
rubric_dict (dict): A dictionary representation of the rubric, of the form
described in the serialized Rubric model (peer grading serializers).
Kwargs:
include_prompt (bool): Whether or not to include the prompt in the
serialized format for a rubric. Defaults to True.
Returns:
None
"""
# Rubric prompt (default to empty text); None indicates no input element
if
include_prompt
and
oa_block
.
prompt
is
not
None
:
prompt
=
etree
.
SubElement
(
rubric_root
,
'prompt'
)
prompt
.
text
=
unicode
(
oa_block
.
prompt
)
# Criteria
criteria_list
=
oa_block
.
rubric_criteria
...
...
@@ -702,6 +694,10 @@ def serialize_content_to_xml(oa_block, root):
assessments_root
=
etree
.
SubElement
(
root
,
'assessments'
)
serialize_assessments
(
assessments_root
,
oa_block
)
# Prompts
prompts_root
=
etree
.
SubElement
(
root
,
'prompts'
)
_serialize_prompts
(
prompts_root
,
oa_block
)
# Rubric
rubric_root
=
etree
.
SubElement
(
root
,
'rubric'
)
serialize_rubric
(
rubric_root
,
oa_block
)
...
...
@@ -740,7 +736,7 @@ def serialize_rubric_to_xml_str(oa_block):
"""
rubric_root
=
etree
.
Element
(
'rubric'
)
serialize_rubric
(
rubric_root
,
oa_block
,
include_prompt
=
False
)
serialize_rubric
(
rubric_root
,
oa_block
)
return
etree
.
tostring
(
rubric_root
,
pretty_print
=
True
,
encoding
=
'unicode'
)
...
...
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