mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
#12890: don't emit <p> tags in text mode when logdir specified.
Patch by Jeff McNeil.
This commit is contained in:
parent
bc876a2d4a
commit
252cd0e4e0
3 changed files with 12 additions and 3 deletions
11
Lib/cgitb.py
11
Lib/cgitb.py
|
|
@ -293,14 +293,19 @@ class Hook:
|
|||
if self.logdir is not None:
|
||||
suffix = ['.txt', '.html'][self.format=="html"]
|
||||
(fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir)
|
||||
|
||||
try:
|
||||
file = os.fdopen(fd, 'w')
|
||||
file.write(doc)
|
||||
file.close()
|
||||
msg = '<p> %s contains the description of this error.' % path
|
||||
msg = '%s contains the description of this error.' % path
|
||||
except:
|
||||
msg = '<p> Tried to save traceback to %s, but failed.' % path
|
||||
self.file.write(msg + '\n')
|
||||
msg = 'Tried to save traceback to %s, but failed.' % path
|
||||
|
||||
if self.format == 'html':
|
||||
self.file.write('<p>%s</p>\n' % msg)
|
||||
else:
|
||||
self.file.write(msg + '\n')
|
||||
try:
|
||||
self.file.flush()
|
||||
except: pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue