Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
8764c7fc
Commit
8764c7fc
authored
12 years ago
by
Vik Paruchuri
Browse files
Options
Downloads
Patches
Plain Diff
Fix exception handling/error messages
parent
5fee1a49
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/combined_open_ended_module.py
+10
-6
10 additions, 6 deletions
common/lib/xmodule/xmodule/combined_open_ended_module.py
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
+2
-1
2 additions, 1 deletion
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
with
12 additions
and
7 deletions
common/lib/xmodule/xmodule/combined_open_ended_module.py
+
10
−
6
View file @
8764c7fc
...
...
@@ -44,6 +44,10 @@ ACCEPT_FILE_UPLOAD = True
#Contains all reasonable bool and case combinations of True
TRUE_DICT
=
[
"
True
"
,
True
,
"
TRUE
"
,
"
true
"
]
class
IncorrectMaxScoreError
(
Exception
):
def
__init__
(
self
,
msg
):
self
.
msg
=
msg
class
CombinedOpenEndedModule
(
XModule
):
"""
This is a module that encapsulates all open ended grading (self assessment, peer assessment, etc).
...
...
@@ -154,23 +158,23 @@ class CombinedOpenEndedModule(XModule):
if
self
.
_max_score
>
MAX_SCORE_ALLOWED
:
error_message
=
"
Max score {0} is higher than max score allowed {1}
"
.
format
(
self
.
_max_score
,
MAX_SCORE_ALLOWED
)
log
.
e
xception
(
error_message
)
raise
Exception
log
.
e
rror
(
error_message
)
raise
IncorrectMaxScoreError
(
error_message
)
rubric_renderer
=
CombinedOpenEndedRubric
(
system
,
True
)
success
,
rubric_feedback
=
rubric_renderer
.
render_rubric
(
stringify_children
(
definition
[
'
rubric
'
]))
if
not
success
:
error_message
=
"
Could not parse rubric : {0}
"
.
format
(
definition
[
'
rubric
'
])
log
.
e
xception
(
error_message
)
raise
Exception
log
.
e
rror
(
error_message
)
raise
RubricParsingError
(
error_message
)
rubric_categories
=
rubric_renderer
.
extract_categories
(
stringify_children
(
definition
[
'
rubric
'
]))
for
category
in
rubric_categories
:
if
len
(
category
[
'
options
'
])
>
(
MAX_SCORE_ALLOWED
+
1
):
error_message
=
"
Number of score points in rubric {0} higher than the max allowed, which is {1}
"
.
format
(
len
(
category
[
'
options
'
]),
MAX_SCORE_ALLOWED
)
log
.
e
xception
(
error_message
)
raise
Exception
log
.
e
rror
(
error_message
)
raise
RubricParsingError
(
error_message
)
#Static data is passed to the child modules to render
self
.
static_data
=
{
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
+
2
−
1
View file @
8764c7fc
...
...
@@ -4,7 +4,8 @@ from lxml import etree
log
=
logging
.
getLogger
(
__name__
)
class
RubricParsingError
(
Exception
):
pass
def
__init__
(
self
,
msg
):
self
.
msg
=
msg
class
CombinedOpenEndedRubric
(
object
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment