changeset 1709:c47ba491a85a

plugin XEP-0277: raise a failure if XHTML content is not wrapped in a <div/>
author Goffi <goffi@goffi.org>
date Tue, 01 Dec 2015 13:55:48 +0100
parents 6d6eae490681
children 7226280e70da
files src/plugins/plugin_xep_0277.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Tue Dec 01 13:55:48 2015 +0100
+++ b/src/plugins/plugin_xep_0277.py	Tue Dec 01 13:55:48 2015 +0100
@@ -173,6 +173,8 @@
             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))