#2830: add html.escape() helper and move cgi.escape() uses in the standard library to it. It defaults to quote=True and also escapes single quotes, which makes casual use safer. The cgi.escape() interface is not touched, but emits a (silent) PendingDeprecationWarning.

This commit is contained in:
Georg Brandl 2010-10-15 15:57:45 +00:00
parent 70543acfa1
commit 1f7fffb308
11 changed files with 94 additions and 28 deletions

View file

@ -568,8 +568,8 @@ class Test_touch_import(support.TestCase):
def test_from_import(self):
node = parse('bar()')
fixer_util.touch_import("cgi", "escape", node)
self.assertEqual(str(node), 'from cgi import escape\nbar()\n\n')
fixer_util.touch_import("html", "escape", node)
self.assertEqual(str(node), 'from html import escape\nbar()\n\n')
def test_name_import(self):
node = parse('bar()')