Merge "Escape apostrophe in utils.xhtml_escape() (lp#872450)"
This commit is contained in:
1
Authors
1
Authors
@@ -131,6 +131,7 @@ MotoKen <motokentsai@gmail.com>
|
|||||||
Muneyuki Noguchi <noguchimn@nttdata.co.jp>
|
Muneyuki Noguchi <noguchimn@nttdata.co.jp>
|
||||||
Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
|
Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
|
||||||
Naveed Massjouni <naveedm9@gmail.com>
|
Naveed Massjouni <naveedm9@gmail.com>
|
||||||
|
Nick Bartos <nick@pistoncloud.com>
|
||||||
Nikhil Komawar <nikhil.komawar@rackspace.com>
|
Nikhil Komawar <nikhil.komawar@rackspace.com>
|
||||||
Nikolay Sokolov <nsokolov@griddynamics.com>
|
Nikolay Sokolov <nsokolov@griddynamics.com>
|
||||||
Nirmal Ranganathan <rnirmal@gmail.com>
|
Nirmal Ranganathan <rnirmal@gmail.com>
|
||||||
|
|||||||
@@ -696,6 +696,10 @@ class DeprecationTest(test.TestCase):
|
|||||||
result = utils.service_is_up(service)
|
result = utils.service_is_up(service)
|
||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
|
||||||
|
def test_xhtml_escape(self):
|
||||||
|
self.assertEqual('"foo"', utils.xhtml_escape('"foo"'))
|
||||||
|
self.assertEqual(''foo'', utils.xhtml_escape("'foo'"))
|
||||||
|
|
||||||
def test_hash_file(self):
|
def test_hash_file(self):
|
||||||
data = 'Mary had a little lamb, its fleece as white as snow'
|
data = 'Mary had a little lamb, its fleece as white as snow'
|
||||||
flo = StringIO.StringIO(data)
|
flo = StringIO.StringIO(data)
|
||||||
|
|||||||
@@ -669,11 +669,8 @@ class LoopingCall(object):
|
|||||||
def xhtml_escape(value):
|
def xhtml_escape(value):
|
||||||
"""Escapes a string so it is valid within XML or XHTML.
|
"""Escapes a string so it is valid within XML or XHTML.
|
||||||
|
|
||||||
Code is directly from the utf8 function in
|
|
||||||
http://github.com/facebook/tornado/blob/master/tornado/escape.py
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return saxutils.escape(value, {'"': '"'})
|
return saxutils.escape(value, {'"': '"', "'": '''})
|
||||||
|
|
||||||
|
|
||||||
def utf8(value):
|
def utf8(value):
|
||||||
|
|||||||
Reference in New Issue
Block a user