Commit 6738a37e by Ned Batchelder Committed by Adam Palay

Keep comments in capa XML from causing failures

Comments (and processing instructions!) are handled oddly in lxml.
This change will keep them from causing failures.  They will be omitted
from the HTML generated, which is fine, since they aren't needed there.
parent cee44501
......@@ -555,6 +555,13 @@ class LoncapaProblem(object):
Used by get_html.
'''
if not isinstance(problemtree.tag, basestring):
# Comment and ProcessingInstruction nodes are not Elements,
# and we're ok leaving those behind.
# BTW: etree gives us no good way to distinguish these things
# other than to examine .tag to see if it's a string. :(
return
if (problemtree.tag == 'script' and problemtree.get('type')
and 'javascript' in problemtree.get('type')):
# leave javascript intact.
......
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