plugin XEP-0071, XEP-0277: method clean_xhtml has been renamed to cleanXHTML

This commit is contained in:
souliane 2016-01-19 11:51:07 +01:00
commit df30ea7a53
3 changed files with 5 additions and 5 deletions

View file

@ -118,7 +118,7 @@ class XEP_0071(object):
if xhtml:
raise exceptions.DataError(_("Can't have xhtml and rich content at the same time"))
if xhtml:
d = self.synt_plg.clean_xhtml(xhtml)
d = self.synt_plg.cleanXHTML(xhtml)
d.addCallback(syntax_converted)
return d

View file

@ -177,7 +177,7 @@ class XEP_0277(object):
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()
microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data)
microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].cleanXHTML(data)
else:
key = check_conflict(elem.name)
microblog_data[key] = unicode(elem)
@ -365,7 +365,7 @@ class XEP_0277(object):
if '{}_xhtml'.format(elem_name) in data:
raise failure.Failure(exceptions.DataError(_("Can't have xhtml and rich content at the same time")))
else: # clean the XHTML input
converted = yield synt.clean_xhtml(data[attr])
converted = yield synt.cleanXHTML(data[attr])
xml_content = u'<div xmlns="{ns}">{converted}</div>'.format(
ns=NS_XHTML,

View file

@ -76,14 +76,14 @@ class SanitisationTest(helpers.SatTestCase):
</img></body>
</div>"""
d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML1)
d = self.text_syntaxes.cleanXHTML(self.EVIL_HTML1)
d.addCallback(self.assertEqualXML, expected, ignore_blank=True)
return d
def test_styles_sanitise(self):
expected = u"""<p style="color: blue">test <strong>retest</strong><br/><span style="color: #cf2828; font-size: 3px; color: red; color: red !important; font-size: 100px !important; font-size: 100%; font-size: 100px; font-size: 100; font-size: 100 %; color: rgba(0, 0, 0, 0.1); color: rgb(35,79,255); background-color: no-repeat"> toto </span></p>"""
d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML2)
d = self.text_syntaxes.cleanXHTML(self.EVIL_HTML2)
d.addCallback(self.assertEqualXML, expected)
return d