Kaydet (Commit) 7d68bfa8 authored tarafından sblondon's avatar sblondon Kaydeden (comit) Serhiy Storchaka

bpo-33256: Replace angle brackets around python object repr to display it in html (GH-6442)

üst 70af06cd
......@@ -124,7 +124,7 @@ function calls leading up to the error, in the order they occurred.</p>'''
args, varargs, varkw, locals = inspect.getargvalues(frame)
call = ''
if func != '?':
call = 'in ' + strong(func) + \
call = 'in ' + strong(pydoc.html.escape(func)) + \
inspect.formatargvalues(args, varargs, varkw, locals,
formatvalue=lambda value: '=' + pydoc.html.repr(value))
......@@ -282,7 +282,7 @@ class Hook:
if self.display:
if plain:
doc = doc.replace('&', '&amp;').replace('<', '&lt;')
doc = pydoc.html.escape(doc)
self.file.write('<pre>' + doc + '</pre>\n')
else:
self.file.write(doc + '\n')
......
......@@ -45,6 +45,7 @@ class TestCgitb(unittest.TestCase):
out = out.decode(sys.getfilesystemencoding())
self.assertIn("ValueError", out)
self.assertIn("Hello World", out)
self.assertIn("<strong>&lt;module&gt;</strong>", out)
# By default we emit HTML markup.
self.assertIn('<p>', out)
self.assertIn('</p>', out)
......
......@@ -158,6 +158,7 @@ Mike Bland
Martin Bless
Pablo Bleyer
Erik van Blokland
Stéphane Blondon
Eric Blossom
Sergey Bobrov
Finn Bock
......
Fix display of ``<module>`` call in the html produced by ``cgitb.html()``. Patch by Stéphane Blondon.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment