diff -r 6374b4ffe00c Lib/cgitb.py --- a/Lib/cgitb.py Fri Sep 02 23:19:52 2011 +0200 +++ b/Lib/cgitb.py Fri Sep 02 22:14:59 2011 -0400 @@ -292,13 +292,16 @@ if self.logdir is not None: suffix = ['.txt', '.html'][self.format=="html"] (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) + + # Only print tags if this is text output. + self.file.write('

' if self.format == 'html' else '') try: file = os.fdopen(fd, 'w') file.write(doc) file.close() - msg = '

%s contains the description of this error.' % path + msg = '%s contains the description of this error.' % path except: - msg = '

Tried to save traceback to %s, but failed.' % path + msg = 'Tried to save traceback to %s, but failed.' % tag self.file.write(msg + '\n') try: self.file.flush()