Commit 44e6572e by Calen Pennington

Make StringyInteger and StringyFloat return None when they can't parse the…

Make StringyInteger and StringyFloat return None when they can't parse the string from json, and don't try to overwrite max_attempts if it's ''
parent 5070e5b2
...@@ -32,7 +32,7 @@ class StringyInteger(Integer): ...@@ -32,7 +32,7 @@ class StringyInteger(Integer):
try: try:
return int(value) return int(value)
except: except:
return value return None
class StringyFloat(Float): class StringyFloat(Float):
...@@ -43,7 +43,7 @@ class StringyFloat(Float): ...@@ -43,7 +43,7 @@ class StringyFloat(Float):
try: try:
return float(value) return float(value)
except: except:
return value return None
# Generated this many different variants of problems with rerandomize=per_student # Generated this many different variants of problems with rerandomize=per_student
...@@ -140,9 +140,6 @@ class CapaModule(CapaFields, XModule): ...@@ -140,9 +140,6 @@ class CapaModule(CapaFields, XModule):
# see comment on randomization_bin # see comment on randomization_bin
self.seed = randomization_bin(system.seed, self.location.url) self.seed = randomization_bin(system.seed, self.location.url)
if self.max_attempts == '':
self.max_attempts = None
# Need the problem location in openendedresponse to send out. Adding # Need the problem location in openendedresponse to send out. Adding
# it to the system here seems like the least clunky way to get it # it to the system here seems like the least clunky way to get it
# there. # there.
...@@ -391,7 +388,7 @@ class CapaModule(CapaFields, XModule): ...@@ -391,7 +388,7 @@ class CapaModule(CapaFields, XModule):
content = {'name': self.display_name_with_default, content = {'name': self.display_name_with_default,
'html': html, 'html': html,
'weight': self.descriptor.weight, 'weight': self.weight,
} }
context = {'problem': content, context = {'problem': content,
......
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