diff --git a/src/core/constants.py b/src/core/constants.py index 805f3b1c..42eab9a1 100644 --- a/src/core/constants.py +++ b/src/core/constants.py @@ -116,6 +116,7 @@ class Const(object): NS_CLIENT = 'jabber:client' NS_FORWARD = 'urn:xmpp:forward:0' NS_DELAY = 'urn:xmpp:delay' + NS_XHTML = 'http://www.w3.org/1999/xhtml' ## Configuration ## diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py index c5eb1239..c39ac07c 100755 --- a/src/plugins/plugin_xep_0277.py +++ b/src/plugins/plugin_xep_0277.py @@ -43,7 +43,6 @@ import urllib NS_MICROBLOG = 'urn:xmpp:microblog:0' NS_ATOM = 'http://www.w3.org/2005/Atom' -NS_XHTML = 'http://www.w3.org/1999/xhtml' NS_PUBSUB_EVENT = "{}{}".format(pubsub.NS_PUBSUB, "#event") NS_COMMENT_PREFIX = '{}:comments/'.format(NS_MICROBLOG) @@ -173,7 +172,7 @@ class XEP_0277(object): data_elt = elem.firstChildElement() if data_elt is None: raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a
element, this is not standard !")) - if data_elt.uri != NS_XHTML: + if data_elt.uri != C.NS_XHTML: raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!'))) key = check_conflict(u'{}_xhtml'.format(elem.name)) data = data_elt.toXml() @@ -367,10 +366,10 @@ class XEP_0277(object): else: xml_content = data[attr] - div_elt = xml_tools.ElementParser()(xml_content, namespace=NS_XHTML) - if div_elt.name != 'div' or div_elt.uri != NS_XHTML or div_elt.attributes: + div_elt = xml_tools.ElementParser()(xml_content, namespace=C.NS_XHTML) + if div_elt.name != 'div' or div_elt.uri != C.NS_XHTML or div_elt.attributes: # we need a wrapping
at the top with XHTML namespace - wrap_div_elt = domish.Element((NS_XHTML, 'div')) + wrap_div_elt = domish.Element((C.NS_XHTML, 'div')) wrap_div_elt.addChild(div_elt) div_elt = wrap_div_elt elem.addChild(div_elt)