Skip to content
Snippets Groups Projects
Commit c020eea2 authored by Diana Huang's avatar Diana Huang
Browse files

Handle case where incoming body may or may not be a unicode string.

parent c94aaffb
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ from xml.sax.saxutils import escape
import six.moves.urllib.error
import six.moves.urllib.parse
from six import text_type
from lxml import etree
from xblockutils.resources import ResourceLoader
......@@ -42,7 +43,8 @@ def parse_grade_xml_body(body):
"""
lti_spec_namespace = "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0"
namespaces = {'def': lti_spec_namespace}
data = body.strip().encode('utf-8')
if isinstance(body, text_type):
data = body.strip().encode('utf-8')
try:
parser = etree.XMLParser(ns_clean=True, recover=True, encoding='utf-8') # pylint: disable=no-member
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment