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
8e213f53
Commit
8e213f53
authored
Jan 14, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubric parsing errors
parent
f5600c2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
common/lib/xmodule/xmodule/combined_open_ended_module.py
+3
-2
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
+2
-2
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
8e213f53
...
@@ -22,6 +22,7 @@ from xmodule.modulestore import Location
...
@@ -22,6 +22,7 @@ from xmodule.modulestore import Location
import
self_assessment_module
import
self_assessment_module
import
open_ended_module
import
open_ended_module
from
combined_open_ended_rubric
import
CombinedOpenEndedRubric
from
combined_open_ended_rubric
import
CombinedOpenEndedRubric
from
.stringify
import
stringify_children
from
mitxmako.shortcuts
import
render_to_string
from
mitxmako.shortcuts
import
render_to_string
...
@@ -142,11 +143,11 @@ class CombinedOpenEndedModule(XModule):
...
@@ -142,11 +143,11 @@ class CombinedOpenEndedModule(XModule):
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
rubric_renderer
=
CombinedOpenEndedRubric
(
True
)
rubric_renderer
=
CombinedOpenEndedRubric
(
True
)
success
,
rubric_feedback
=
rubric_renderer
.
render_rubric
(
True
,
definition
[
'rubric'
]
)
success
,
rubric_feedback
=
rubric_renderer
.
render_rubric
(
stringify_children
(
definition
[
'rubric'
])
)
if
not
success
:
if
not
success
:
error_message
=
"Could not parse rubric : {0}"
.
format
(
definition
[
'rubric'
])
error_message
=
"Could not parse rubric : {0}"
.
format
(
definition
[
'rubric'
])
log
.
exception
(
error_message
)
log
.
exception
(
error_message
)
raise
Exception
(
error_message
)
raise
Exception
#Static data is passed to the child modules to render
#Static data is passed to the child modules to render
self
.
static_data
=
{
self
.
static_data
=
{
'max_score'
:
self
.
_max_score
,
'max_score'
:
self
.
_max_score
,
...
...
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
View file @
8e213f53
...
@@ -22,7 +22,6 @@ class CombinedOpenEndedRubric:
...
@@ -22,7 +22,6 @@ class CombinedOpenEndedRubric:
def
render_rubric
(
self
,
rubric_xml
):
def
render_rubric
(
self
,
rubric_xml
):
success
=
False
success
=
False
try
:
try
:
rubric_xml
=
rubric_xml
.
encode
(
'ascii'
,
'ignore'
)
rubric_categories
=
self
.
extract_categories
(
rubric_xml
)
rubric_categories
=
self
.
extract_categories
(
rubric_xml
)
html
=
render_to_string
(
'open_ended_rubric.html'
,
html
=
render_to_string
(
'open_ended_rubric.html'
,
{
'categories'
:
rubric_categories
,
{
'categories'
:
rubric_categories
,
...
@@ -53,7 +52,8 @@ class CombinedOpenEndedRubric:
...
@@ -53,7 +52,8 @@ class CombinedOpenEndedRubric:
{text: "Option 3 Name", points: 2]}]
{text: "Option 3 Name", points: 2]}]
'''
'''
element
=
etree
.
fromstring
(
element
)
if
isinstance
(
element
,
basestring
):
element
=
etree
.
fromstring
(
element
)
categories
=
[]
categories
=
[]
for
category
in
element
:
for
category
in
element
:
if
category
.
tag
!=
'category'
:
if
category
.
tag
!=
'category'
:
...
...
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