[Python-checkins] cpython (3.2): #12890: don't emit <p> tags in text mode when logdir specified.
r.david.murray
python-checkins at python.org
Sat Oct 27 20:57:40 CEST 2012
http://hg.python.org/cpython/rev/abbfb89055d3
changeset: 79972:abbfb89055d3
branch: 3.2
parent: 79968:5b1331857cbf
user: R David Murray <rdmurray at bitdance.com>
date: Sat Oct 27 14:42:47 2012 -0400
summary:
#12890: don't emit <p> tags in text mode when logdir specified.
Patch by Jeff McNeil.
files:
Lib/cgitb.py | 11 ++++++++---
Misc/ACKS | 1 +
Misc/NEWS | 3 +++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Lib/cgitb.py b/Lib/cgitb.py
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -293,14 +293,19 @@
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
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -699,6 +699,7 @@
Gordon McMillan
Caolan McNamara
Andrew McNamara
+Jeff McNeil
Craig McPheeters
Lambert Meertens
Bill van Melle
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@
Library
-------
+- Issue #12890: cgitb no longer prints spurious <p> tags in text
+ mode when the logdir option is specified.
+
- Issue #16250: Fix URLError invocation with proper args.
- Issue #16305: Fix a segmentation fault occurring when interrupting
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list