]> granicus.if.org Git - python/commitdiff
#12890: don't emit <p> tags in text mode when logdir specified.
authorR David Murray <rdmurray@bitdance.com>
Sat, 27 Oct 2012 18:42:47 +0000 (14:42 -0400)
committerR David Murray <rdmurray@bitdance.com>
Sat, 27 Oct 2012 18:42:47 +0000 (14:42 -0400)
Patch by Jeff McNeil.

Lib/cgitb.py
Misc/ACKS
Misc/NEWS

index 7b52c8e74c1e78f3f705007ab6ce71bfabdc0598..6da40e82ece47ae489c91b1c051e66a91c647181 100644 (file)
@@ -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
index 182c6a6d67d5a07a1a5abe7dc2e0882c50531466..2b97f51a3777999e216f83df206f283398ee1f5e 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -699,6 +699,7 @@ Mark Mc Mahon
 Gordon McMillan
 Caolan McNamara
 Andrew McNamara
+Jeff McNeil
 Craig McPheeters
 Lambert Meertens
 Bill van Melle
index a7af2ccf3df3dddbf70c1df69f6bc7216fbe77ec..5010f70bd5304451b98e8b9f64b25de1e2e5e65a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@ Core and Builtins
 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