Title: does parse_header really belong in CGI module?
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.4
Status: languishing Resolution:
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: flox, janssen, mgiuca, orsenthil
Priority: normal Keywords: patch

Created on 2008-08-20 00:51 by janssen, last changed 2012-07-21 12:29 by flox.

File name Uploaded Description Edit
issue3609-py27.diff orsenthil, 2009-04-02 21:46 review
Messages (5)
msg71500 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-08-20 00:51
Not sure how to class this, but shouldn't the "parse_header" function in
cgi really be in email.header?  And what about parse_multipart?
msg71512 - (view) Author: Matt Giuca (mgiuca) Date: 2008-08-20 05:08
These functions are for generic MIME headers and bodies, so are
applicable to CGI, HTTP, Email, and any other protocols based on MIME.
So I think having them in email.header makes about as much sense as
having them in cgi.

Isn't mimetools a better package for this?

Also I think there's an exodus of functions from cgi -- there's talk
about parse_qs/parse_qsl being moved to urllib (I thought that was
almost finalised). Traditionally the cgi module has had way too much
stuff in it which only superficially applies to cgi.

I'm also thinking of cgi.escape, which I'd rather see in htmllib than
cgi (except that htmllib is described as "A parser for HTML documents").

But I'm worried that these functions are too ingrained in people's
memories (I type "cgi.escape" several times a day and I'd get confused
if it moved). So perhaps these moves are too late.

I imagine if they were moved (at least for a few versions) the old ones
would still work, with a deprecation warning?
msg71515 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-08-20 06:21
> I imagine if they were moved (at least for a few versions) the old ones
> would still work, with a deprecation warning?

Yes, that's what I was thinking.
msg85270 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-04-02 21:46
The attached patch takes care of relocating the parse_header function
from cgi module to email.header module in Python2.7.

Few comments:

1)parse_multipart need not be moved from cgi, because it is discouraged
to use parse_multipart and it is advised to use FieldStorage class
methods which does the same thing.

2)Should the relocation happen in Python 2.7 as well as in Python 3K or
only in Python 3k?  ( The patch is for Python 2.7, but can be ported to
Python 3k).

4) If changes happen in Python 2.7, then cgi.parse_header will have
DeprecationWarning just in case we go for more versions in Python 2.x

5)Does anyone have any concerns with this change?  I plan to ask at
Python-Dev as well?
msg166015 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2012-07-21 12:29
This refactoring between cgi and email modules is languishing for few years.
Any thought?
Date User Action Args
2012-07-21 12:29:46floxsetstatus: open -> languishing

messages: + msg166015
versions: + Python 3.4, - Python 3.2
2010-08-27 03:26:48floxsetnosy: + flox
stage: patch review

versions: + Python 3.2, - Python 3.0
2009-04-02 21:46:04orsenthilsetfiles: + issue3609-py27.diff
assignee: orsenthil
messages: + msg85270

keywords: + patch
2008-09-19 12:07:12orsenthilsetnosy: + orsenthil
2008-08-20 06:21:24janssensetmessages: + msg71515
2008-08-20 05:08:05mgiucasetnosy: + mgiuca
messages: + msg71512
2008-08-20 00:51:16janssencreate