diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-02-20 14:26:25 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-02-20 14:26:25 +0000 |
| commit | 1d5b9dca8b237b53a8f09aa8a4dd7846796ea96b (patch) | |
| tree | a4c0f081f09704622438c9b0f0f96347d61d77df | |
| parent | c1939e576be7ce96735c4734913ae9274752fed9 (diff) | |
| parent | ea0e925972c944ac4586887d7fd2e9c27225dd83 (diff) | |
| download | nova-1d5b9dca8b237b53a8f09aa8a4dd7846796ea96b.tar.gz nova-1d5b9dca8b237b53a8f09aa8a4dd7846796ea96b.tar.xz nova-1d5b9dca8b237b53a8f09aa8a4dd7846796ea96b.zip | |
Merge "Escape apostrophe in utils.xhtml_escape() (lp#872450)"
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | nova/tests/test_utils.py | 4 | ||||
| -rw-r--r-- | nova/utils.py | 5 |
3 files changed, 6 insertions, 4 deletions
@@ -131,6 +131,7 @@ MotoKen <motokentsai@gmail.com> Muneyuki Noguchi <noguchimn@nttdata.co.jp> Nachi Ueno <ueno.nachi@lab.ntt.co.jp> Naveed Massjouni <naveedm9@gmail.com> +Nick Bartos <nick@pistoncloud.com> Nikhil Komawar <nikhil.komawar@rackspace.com> Nikolay Sokolov <nsokolov@griddynamics.com> Nirmal Ranganathan <rnirmal@gmail.com> diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index c60dc26a9..93146876e 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -696,6 +696,10 @@ class DeprecationTest(test.TestCase): result = utils.service_is_up(service) 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): data = 'Mary had a little lamb, its fleece as white as snow' flo = StringIO.StringIO(data) diff --git a/nova/utils.py b/nova/utils.py index 85f39dbe0..dc8a660a6 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -669,11 +669,8 @@ class LoopingCall(object): def xhtml_escape(value): """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): |
