From fb59752c750046903ef0cd17bc9b721d7f573cde Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Thu, 12 Sep 2019 15:11:44 -0400 Subject: [PATCH] Need to return a unicode string in the xml factory. The underlying data is put into json documents that expect unicode strings not byte strings. In python2 lxml provided strings that were auto coerced but in python3 it provides byte strings. --- common/lib/capa/capa/tests/response_xml_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/tests/response_xml_factory.py b/common/lib/capa/capa/tests/response_xml_factory.py index de4c17bae3..af62ef715c 100644 --- a/common/lib/capa/capa/tests/response_xml_factory.py +++ b/common/lib/capa/capa/tests/response_xml_factory.py @@ -102,7 +102,7 @@ class ResponseXMLFactory(six.with_metaclass(ABCMeta, object)): explanation_div.set("class", "detailed-solution") explanation_div.text = explanation_text - return etree.tostring(root) + return etree.tostring(root).decode('utf-8') @staticmethod def textline_input_xml(**kwargs):