Commit 719a898e by Christina Roberts

Merge pull request #2018 from edx/christina/export-bug

Bug fixes related to unicode support in export workflow.
parents 7b6d04d2 dc3b5ab5
...@@ -184,13 +184,13 @@ class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor): ...@@ -184,13 +184,13 @@ class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor):
def definition_to_xml(self, resource_fs): def definition_to_xml(self, resource_fs):
"""Return an xml element representing to this definition.""" """Return an xml element representing to this definition."""
poll_str = '<{tag_name}>{text}</{tag_name}>'.format( poll_str = u'<{tag_name}>{text}</{tag_name}>'.format(
tag_name=self._tag_name, text=self.question) tag_name=self._tag_name, text=self.question)
xml_object = etree.fromstring(poll_str) xml_object = etree.fromstring(poll_str)
xml_object.set('display_name', self.display_name) xml_object.set('display_name', self.display_name)
def add_child(xml_obj, answer): def add_child(xml_obj, answer):
child_str = '<{tag_name} id="{id}">{text}</{tag_name}>'.format( child_str = u'<{tag_name} id="{id}">{text}</{tag_name}>'.format(
tag_name=self._child_tag_name, id=answer['id'], tag_name=self._child_tag_name, id=answer['id'],
text=answer['text']) text=answer['text'])
child_node = etree.fromstring(child_str) child_node = etree.fromstring(child_str)
......
...@@ -387,7 +387,10 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -387,7 +387,10 @@ class XmlDescriptor(XModuleDescriptor):
try: try:
xml_object.set(attr, val) xml_object.set(attr, val)
except Exception, e: except Exception, e:
logging.exception('Failed to serialize metadata attribute {0} with value {1}. This could mean data loss!!! Exception: {2}'.format(attr, val, e)) logging.exception(
u'Failed to serialize metadata attribute %s with value %s in module %s. This could mean data loss!!! Exception: %s',
attr, val, self.url_name, e
)
pass pass
for key, value in self.xml_attributes.items(): for key, value in self.xml_attributes.items():
......
<sequential> <sequential>
<poll_question name="T1_changemind_poll_foo" display_name="Change your answer" reset="false"> <poll_question name="T1_changemind_poll_foo" display_name="Change your answer" reset="false">
<p>Have you changed your mind?</p> <p>Have you changed your mind?</p>
<answer id="yes">Yes</answer> <answer id="yes">Yes</answer>
<answer id="no">No</answer> <answer id="no">No</answer>
</poll_question> </poll_question>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment