Commit f355e4a8 by Peter Fogg

More general solution to word cloud export problems.

parent 0967cb0d
......@@ -20,6 +20,8 @@ class RawDescriptor(XmlDescriptor, XMLEditingDescriptor):
return {'data': etree.tostring(xml_object, pretty_print=True, encoding='unicode')}, []
def definition_to_xml(self, resource_fs):
if not self.data:
return etree.fromstring('<{0} />'.format(self.category))
try:
return etree.fromstring(self.data)
except etree.XMLSyntaxError as err:
......
......@@ -130,13 +130,6 @@ class VideoDescriptor(VideoFields,
_parse_video_xml(video, video.data)
return video
def definition_to_xml(self, resource_fs):
"""
Override the base implementation. We don't actually have anything in the 'data' field
(it's an empty string), so we just return a simple XML element
"""
return etree.Element('video')
def _parse_video_xml(video, xml_data):
"""
......
......@@ -9,8 +9,6 @@ If student have answered - words he entered and cloud.
import json
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.raw_module import RawDescriptor
from xmodule.editing_module import MetadataOnlyEditingDescriptor
......@@ -246,9 +244,3 @@ class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, RawDes
"""Descriptor for WordCloud Xmodule."""
module_class = WordCloudModule
template_dir_name = 'word_cloud'
def definition_to_xml(self, resource_fs):
"""
Since there's no real data, just return an empty XML tag.
"""
return etree.fromstring('<word_cloud />')
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