This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cgitb displays

tags when executed in text mode

Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: aliles, eric.araujo, ezio.melotti, mcjeff, mjdorma, python-dev, r.david.murray, sptonkin
Priority: normal Keywords: patch

Created on 2011-09-03 02:22 by mcjeff, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
head-cgitb-display.patch mcjeff, 2011-11-21 14:34 review
issue12890.diff ezio.melotti, 2012-08-26 04:45 review
p12890-2.diff sptonkin, 2012-10-30 01:21 Patch addressing error on Windows 7. review
Messages (21)
msg143449 - (view) Author: Jeff McNeil (mcjeff) * Date: 2011-09-03 02:21
If cgitb.enable is ran with a logdir set and a format='text' argument, then a trailing message is printed that includes <p> tags.  This should only happen if the format requested is HTML.

The following tiny script shows the problem:

import cgitb
cgitb.enable(format='text', logdir='/tmp')
1/0

Attaching a small patch which addresses. This is against tip on the default branch.

mcjeff@macbook:~/cpython$ ./python.exe --version
Python 3.3.0a0
msg147956 - (view) Author: Jeff McNeil (mcjeff) * Date: 2011-11-19 17:07
Is there anything else needed here?
msg147960 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-11-19 17:27
A test?
msg147963 - (view) Author: Jeff McNeil (mcjeff) * Date: 2011-11-19 17:57
I didn't add one initially as I was just changing output format and not actual behavior.  I guess I could add something to ensure it doesn't regress? I'll make sure there's coverage to begin with.
msg147965 - (view) Author: Jeff McNeil (mcjeff) * Date: 2011-11-19 18:20
Test to ensure html isn't included when the formatting is text.  I don't seem to be able to update the stage.
msg147986 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-20 12:20
Thanks for the updated patch.  I made a review, you should have received an email.  When you make a new patch, it would be most helpful if you could make one patch with code and tests changes, and then we’ll remove the old versions.
msg148005 - (view) Author: Jeff McNeil (mcjeff) * Date: 2011-11-20 19:43
Added everything to one file. Updated tests to also include a logdir argument as that is required to trigger the original bug.  Weeded out a spurious write that occurred when format was set to text.
msg148056 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-21 15:24
Latest patch is good to go.
msg155578 - (view) Author: Jeff McNeil (mcjeff) * Date: 2012-03-13 08:03
Did this ever get committed? Is there anything left for me to do here?
msg155596 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-13 12:13
I’ll apply it shortly.
msg169161 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-08-26 04:45
What about closing the </p> too (see attached patch)?
(I know the </p> is not necessary, but I prefer to add it.)
msg173958 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-27 18:57
New changeset 715e5b337c91 by R David Murray in branch '2.7':
#12890: don't emit <p> tags in text mode when logdir specified.
http://hg.python.org/cpython/rev/715e5b337c91

New changeset abbfb89055d3 by R David Murray in branch '3.2':
#12890: don't emit <p> tags in text mode when logdir specified.
http://hg.python.org/cpython/rev/abbfb89055d3

New changeset 45764e4bb504 by R David Murray in branch '3.3':
merge #12890: don't emit <p> tags in text mode when logdir specified.
http://hg.python.org/cpython/rev/45764e4bb504

New changeset b21c28258d3c by R David Murray in branch 'default':
merge #12890: don't emit <p> tags in text mode when logdir specified.
http://hg.python.org/cpython/rev/b21c28258d3c
msg173959 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-10-27 18:59
Committed with Ezio's <\p> and with simplification of the tests by using script_helper.  Thanks, Jeff!
msg173980 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-10-27 21:33
The tests fail on Widows7 on the buildbots.  (They work fine in my XP Windows VM.)
msg173982 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-27 21:40
New changeset 0e4574595674 by R David Murray in branch '3.3':
#12890: skip tests which fail on windows until fixed or rewritten.
http://hg.python.org/cpython/rev/0e4574595674

New changeset 57a33af85407 by R David Murray in branch 'default':
merge #12890: skip tests which fail on windows until fixed or rewritten.
http://hg.python.org/cpython/rev/57a33af85407
msg173984 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-10-27 21:41
I put in a skip until we either fix the tests or rewrite them as suggested in issue 15749.
msg174173 - (view) Author: Stephen Tonkin (sptonkin) * Date: 2012-10-30 01:21
Uploaded a patch which fixes the failing on Windows 7.

It was essentially an issue with the Windows path returned by temp_dir() containing unescaped backslashes. A repr() fixed this.
msg174174 - (view) Author: Aaron Iles (aliles) * Date: 2012-10-30 01:22
Patch successfully tested on Mac OSX 10.8. No regressions.
msg174177 - (view) Author: Michael Dorman (mjdorma) * Date: 2012-10-30 01:31
Patch (p12890-2.diff) successfully tested on Windows 7 64. No regressions.
msg174249 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-31 00:21
New changeset 7648b7ed6d91 by R David Murray in branch '3.3':
#12890: fix test on windows
http://hg.python.org/cpython/rev/7648b7ed6d91

New changeset d24befb680d6 by R David Murray in branch 'default':
#12890: fix test on windows
http://hg.python.org/cpython/rev/d24befb680d6
msg174250 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-10-31 00:22
Thanks everyone.
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57099
2012-10-31 00:22:24r.david.murraysetstatus: open -> closed

messages: + msg174250
stage: patch review -> resolved
2012-10-31 00:21:26python-devsetmessages: + msg174249
2012-10-30 01:31:00mjdormasetnosy: + mjdorma
messages: + msg174177
2012-10-30 01:22:06alilessetnosy: + aliles
messages: + msg174174
2012-10-30 01:21:15sptonkinsetfiles: + p12890-2.diff
nosy: + sptonkin
messages: + msg174173

2012-10-27 21:41:01r.david.murraysetmessages: + msg173984
2012-10-27 21:40:08python-devsetmessages: + msg173982
2012-10-27 21:33:18r.david.murraysetstatus: closed -> open
assignee: eric.araujo ->
messages: + msg173980
2012-10-27 18:59:26r.david.murraysetstatus: open -> closed
versions: + Python 3.4
nosy: + r.david.murray

messages: + msg173959

resolution: fixed
2012-10-27 18:57:37python-devsetnosy: + python-dev
messages: + msg173958
2012-08-26 04:45:56ezio.melottisetfiles: + issue12890.diff

messages: + msg169161
2012-03-13 12:13:32eric.araujosetassignee: eric.araujo
messages: + msg155596
2012-03-13 08:03:57mcjeffsetmessages: + msg155578
2011-11-21 15:24:56eric.araujosetmessages: + msg148056
versions: + Python 2.7, Python 3.2
2011-11-21 15:23:50eric.araujosetfiles: - head-cgitb-display.patch
2011-11-21 14:34:24mcjeffsetfiles: + head-cgitb-display.patch
2011-11-21 13:50:17eric.araujosetfiles: - head-cgitb-display-tests.patch
2011-11-21 13:50:14eric.araujosetfiles: - head-cgitb-display.patch
2011-11-20 19:43:43mcjeffsetfiles: + head-cgitb-display.patch

messages: + msg148005
2011-11-20 12:20:32eric.araujosetnosy: + eric.araujo
messages: + msg147986
2011-11-19 18:21:32ezio.melottisetstage: test needed -> patch review
2011-11-19 18:20:41mcjeffsetfiles: + head-cgitb-display-tests.patch

messages: + msg147965
2011-11-19 17:57:08mcjeffsetmessages: + msg147963
2011-11-19 17:27:51ezio.melottisettype: behavior
messages: + msg147960
stage: test needed
2011-11-19 17:07:40mcjeffsetmessages: + msg147956
2011-09-08 10:26:09ezio.melottisetnosy: + ezio.melotti
2011-09-03 02:22:00mcjeffcreate