Skip to content
Snippets Groups Projects
Unverified Commit 4ee37e61 authored by Diana Huang's avatar Diana Huang Committed by GitHub
Browse files

Merge pull request #50 from edx/diana/handle-input

Handle case where body may or may not be unicode.
parents c94aaffb 31fca583
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ from xml.sax.saxutils import escape ...@@ -12,6 +12,7 @@ from xml.sax.saxutils import escape
import six.moves.urllib.error import six.moves.urllib.error
import six.moves.urllib.parse import six.moves.urllib.parse
from six import text_type
from lxml import etree from lxml import etree
from xblockutils.resources import ResourceLoader from xblockutils.resources import ResourceLoader
...@@ -42,7 +43,8 @@ def parse_grade_xml_body(body): ...@@ -42,7 +43,8 @@ def parse_grade_xml_body(body):
""" """
lti_spec_namespace = "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0" lti_spec_namespace = "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0"
namespaces = {'def': lti_spec_namespace} namespaces = {'def': lti_spec_namespace}
data = body.strip().encode('utf-8') if isinstance(body, text_type):
data = body.strip().encode('utf-8')
try: try:
parser = etree.XMLParser(ns_clean=True, recover=True, encoding='utf-8') # pylint: disable=no-member parser = etree.XMLParser(ns_clean=True, recover=True, encoding='utf-8') # pylint: disable=no-member
......
...@@ -25,7 +25,7 @@ def package_data(pkg, roots): ...@@ -25,7 +25,7 @@ def package_data(pkg, roots):
setup( setup(
name='lti_consumer-xblock', name='lti_consumer-xblock',
version='1.2.1', version='1.2.2',
description='This XBlock implements the consumer side of the LTI specification.', description='This XBlock implements the consumer side of the LTI specification.',
packages=[ packages=[
'lti_consumer', 'lti_consumer',
......
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