Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 252cd0e

Browse files
committedOct 27, 2012
python#12890: don't emit <p> tags in text mode when logdir specified.
Patch by Jeff McNeil.
1 parent bc876a2 commit 252cd0e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
 

‎Lib/cgitb.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,19 @@ def handle(self, info=None):
293293
if self.logdir is not None:
294294
suffix = ['.txt', '.html'][self.format=="html"]
295295
(fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir)
296+
296297
try:
297298
file = os.fdopen(fd, 'w')
298299
file.write(doc)
299300
file.close()
300-
msg = '<p> %s contains the description of this error.' % path
301+
msg = '%s contains the description of this error.' % path
301302
except:
302-
msg = '<p> Tried to save traceback to %s, but failed.' % path
303-
self.file.write(msg + '\n')
303+
msg = 'Tried to save traceback to %s, but failed.' % path
304+
305+
if self.format == 'html':
306+
self.file.write('<p>%s</p>\n' % msg)
307+
else:
308+
self.file.write(msg + '\n')
304309
try:
305310
self.file.flush()
306311
except: pass

‎Misc/ACKS

+1
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ Mark Mc Mahon
699699
Gordon McMillan
700700
Caolan McNamara
701701
Andrew McNamara
702+
Jeff McNeil
702703
Craig McPheeters
703704
Lambert Meertens
704705
Bill van Melle

‎Misc/NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ Core and Builtins
132132
Library
133133
-------
134134

135+
- Issue #12890: cgitb no longer prints spurious <p> tags in text
136+
mode when the logdir option is specified.
137+
135138
- Issue #16250: Fix URLError invocation with proper args.
136139

137140
- Issue #16305: Fix a segmentation fault occurring when interrupting

0 commit comments

Comments
 (0)
Please sign in to comment.