Skip to content

Commit

Permalink
Fix grading_data errors, when grading_data is not a dict
Browse files Browse the repository at this point in the history
  • Loading branch information
raphendyr committed Aug 20, 2018
1 parent 0aef0dc commit 802ca1a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exercise/templatetags/exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ def get_grading_errors(submission):
if grading_data.startswith('<pre>'):
return grading_data[5:-6]
try:
grading_data = json.loads(grading_data)
except (TypeError, ValueError):
return json.loads(grading_data).get('errors', "")
except (AttributeError, TypeError, ValueError):
return ""
return grading_data.get('errors', "")


@register.inclusion_tag("exercise/_text_stats.html", takes_context=True)
Expand Down

0 comments on commit 802ca1a

Please sign in to comment.