Cleaner fix for byte conversion in from_xml

This commit is contained in:
Jeremy Bowman
2019-08-19 14:26:08 -04:00
parent 68933ec089
commit 97c0684755

View File

@@ -1153,7 +1153,9 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
# bleh, have to parse the XML here to just pull out the url_name attribute
# I don't think it's stored anywhere in the instance.
course_file = BytesIO(six.binary_type(xml_data))
if isinstance(xml_data, six.text_type):
xml_data = xml_data.encode('ascii', 'ignore')
course_file = BytesIO(xml_data)
xml_obj = etree.parse(course_file, parser=edx_xml_parser).getroot()
policy_dir = None