plugin XEP-0277: raise a failure if XHTML content is not wrapped in a <div/>

This commit is contained in:
Goffi 2015-12-01 13:55:48 +01:00
commit 2a015e3bec

View file

@ -173,6 +173,8 @@ class XEP_0277(object):
type_ = elem.getAttribute('type')
if type_ == 'xhtml':
data_elt = elem.firstChildElement()
if data_elt is None:
raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a <div/> element, this is not standard !"))
if data_elt.uri != NS_XHTML:
raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!')))
key = check_conflict(u'{}_xhtml'.format(elem.name))