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

(cherry picked from commit 7d68bfa826)

Co-authored-by: sblondon <sblondon@users.noreply.github.com>
This commit is contained in:
Serhiy Storchaka 2018-04-30 11:34:47 +03:00 committed by GitHub
parent 07c3a612c7
commit 07ad02f62c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -125,7 +125,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))
@ -285,7 +285,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')

View File

@ -138,6 +138,7 @@ Mike Bland
Martin Bless
Pablo Bleyer
Erik van Blokland
Stéphane Blondon
Eric Blossom
Sergey Bobrov
Finn Bock

View File

@ -0,0 +1 @@
Fix display of ``<module>`` call in the html produced by ``cgitb.html()``. Patch by Stéphane Blondon.