Commit 7db93976 by Peter Baratta

PR fixes

parent f623e429
...@@ -22,7 +22,7 @@ from xblock.core import Scope, String, Boolean, Dict, Integer, Float ...@@ -22,7 +22,7 @@ from xblock.core import Scope, String, Boolean, Dict, Integer, Float
from .fields import Timedelta, Date from .fields import Timedelta, Date
from django.utils.timezone import UTC from django.utils.timezone import UTC
log = logging.getLogger("mitx.courseware") # pylint: disable=C0103 log = logging.getLogger("mitx.courseware")
# Generate this many different variants of problems with rerandomize=per_student # Generate this many different variants of problems with rerandomize=per_student
...@@ -51,9 +51,6 @@ class Randomization(String): ...@@ -51,9 +51,6 @@ class Randomization(String):
Define a field to store how to randomize a problem. Define a field to store how to randomize a problem.
""" """
def from_json(self, value): def from_json(self, value):
"""
For backward compatability?
"""
if value in ("", "true"): if value in ("", "true"):
return "always" return "always"
elif value == "false": elif value == "false":
...@@ -865,8 +862,8 @@ class CapaModule(CapaFields, XModule): ...@@ -865,8 +862,8 @@ class CapaModule(CapaFields, XModule):
except Exception as err: except Exception as err:
if self.system.DEBUG: if self.system.DEBUG:
msg = "Error checking problem: " + err.message msg = u"Error checking problem: {}".format(err.message)
msg += '\nTraceback:\n' + traceback.format_exc() msg += u'\nTraceback:\n{}'.format(traceback.format_exc())
return {'success': msg} return {'success': msg}
raise raise
......
...@@ -505,9 +505,10 @@ class CapaModuleTest(unittest.TestCase): ...@@ -505,9 +505,10 @@ class CapaModuleTest(unittest.TestCase):
def test_check_problem_error(self): def test_check_problem_error(self):
# Try each exception that capa_module should handle # Try each exception that capa_module should handle
for exception_class in [StudentInputError, exception_classes = [StudentInputError,
LoncapaProblemError, LoncapaProblemError,
ResponseError]: ResponseError]
for exception_class in exception_classes:
# Create the module # Create the module
module = CapaFactory.create(attempts=1) module = CapaFactory.create(attempts=1)
...@@ -532,9 +533,10 @@ class CapaModuleTest(unittest.TestCase): ...@@ -532,9 +533,10 @@ class CapaModuleTest(unittest.TestCase):
def test_check_problem_error_nonascii(self): def test_check_problem_error_nonascii(self):
# Try each exception that capa_module should handle # Try each exception that capa_module should handle
for exception_class in [StudentInputError, exception_classes = [StudentInputError,
LoncapaProblemError, LoncapaProblemError,
ResponseError]: ResponseError]
for exception_class in exception_classes:
# Create the module # Create the module
module = CapaFactory.create(attempts=1) module = CapaFactory.create(attempts=1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment