Commit 7e2ad35c by John Lee

Catch ValueError around the calls to float() rather than swallowing everything

parent 0c88d25e
...@@ -118,7 +118,7 @@ class SchoolYourselfReviewXBlock(SchoolYourselfXBlock): ...@@ -118,7 +118,7 @@ class SchoolYourselfReviewXBlock(SchoolYourselfXBlock):
# The mastery level being passed in should be a number, otherwise # The mastery level being passed in should be a number, otherwise
# things later on in this method will choke. # things later on in this method will choke.
mastery_level = float(mastery_level) mastery_level = float(mastery_level)
except: except ValueError:
return "bad_request" return "bad_request"
# Verify the signature. # Verify the signature.
...@@ -129,7 +129,7 @@ class SchoolYourselfReviewXBlock(SchoolYourselfXBlock): ...@@ -129,7 +129,7 @@ class SchoolYourselfReviewXBlock(SchoolYourselfXBlock):
# Every entry should be a number. # Every entry should be a number.
try: try:
mastery[key] = float(mastery[key]) mastery[key] = float(mastery[key])
except: except ValueError:
return "bad_request" return "bad_request"
verifier.update("%.2f" % mastery[key]) verifier.update("%.2f" % mastery[key])
......
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