Commit dc3b5ab5 by cahrens

Support unicode in text field.

Part of STUD-868
parent df5b22e5
...@@ -182,13 +182,13 @@ class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor): ...@@ -182,13 +182,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)
......
<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