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: relocate cgi.parse_qs() into urlparse
Type: enhancement Stage:
Components: None Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: facundobatista Nosy List: brett.cannon, draghuram, dyoo, facundobatista, hdiogenes, mgiuca, orsenthil
Priority: normal Keywords: patch

Created on 2002-08-26 18:24 by dyoo, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue600362-py26-v3.diff orsenthil, 2008-09-03 15:21
issue600362-py3k-v3.diff orsenthil, 2008-09-03 15:21
Messages (14)
msg61094 - (view) Author: Danny Yoo (dyoo) Date: 2002-08-26 18:24
The location of the url-handling functions are
distributed among several modules, and it would be good
to consolidate them to make them easier to find.

The urlparse.urlparse() function splits an url into its
relative pieces.  However, it does not parse out the
query string into a dictionary --- that role is played
by cgi.parse_qs().  And to convert a dictionary back to
a query string, the programmer needs to know that that
function is in urllib.urlencode.


It would be nice to have cgi.parse_qs() and
urllib.urlencode() in a unified place, within in the
urlparse module if appropriate.  This will help reduce
the amount of hunting-and-pecking that beginners do
when they're trying to deal with URLs.


See:

http://mail.python.org/pipermail/tutor/2002-August/016823.html

for more information.

Thanks!
msg61095 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-05-13 03:25
Logged In: YES 
user_id=357491

This is a problem.  Should a wrapper in urlparse for cgi.parse_qs but created 
or should it just be documented that to parse a query string you should use 
cgi.parse_qs?
msg61868 - (view) Author: Raghuram Devarakonda (draghuram) (Python triager) Date: 2008-01-30 16:12
I know that Senthil has been working on consolidating url related
functionalities so I am adding him to the list.
msg67601 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2008-06-01 20:52
parse_qs and parse_qsl moved to urlparse with this patch.
I dont think urlencode would be a good method for urlparse. But this
will cease to exist with the addressing of 3108.
msg68551 - (view) Author: Humberto Diógenes (hdiogenes) * Date: 2008-06-21 22:20
The patch is not applying cleanly.

BTW, urlparse has been renamed to urllib.parse, but the old docs are still 
there (urlparse.rst).
msg68557 - (view) Author: Humberto Diógenes (hdiogenes) * Date: 2008-06-22 04:00
Correction: the patch does apply cleanly to 2.6, without breaking tests. 
It just needs to be ported to 3.0 (new urllib package).
msg68946 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2008-06-29 11:02
- Updated patches for Python 2.6 and Python 3.0
- Moved the tests.
- Updated docs.

Somebody please review this so that it can checked in.
msg69099 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-02 14:59
Hi Senthil, some details:

- You should not withdraw the parse_qsl from cgi.rst (btw, why didn't
you extracted also the parse_qs one?), but put a Deprecation message,
saying that the user should use it from the urlparse module.

- In cgi.py, in the added message "parse query string functions called
from urlparse", you should say that this is for backward compatibility
reasons.

- You defined an "unquote" function in urlparse.py. Isn't this function
the same that already exists in urllib? Why can't you just use that one?

Thank you!!
msg71151 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2008-08-14 20:25
Hi Facundo,
This issue/comments somehow escaped from my noticed, initially. I have
addressed your comments in the new set of patches.

1) Previous patch Docs had issues. Updated the Docs patch.
2) Included message in cgi.py about parse_qs, parse_qsl being present
for backward compatiblity.
3) The reason, py26 version of patch has quote function from urllib is
to avoid circular reference. urllib import urlparse for urljoin method.
So only way for us use quote is to have that portion of code in the
patch as well.

Please have a look the patches. 
As this request has been present from a long time ( 2002-08-26 !), is it
possible to include this change in b3?

Thanks,
Senthil
msg71214 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-08-16 14:06
This is ok, maybe with some small changes in the docs.

I asked in python-dev if this should go now or wait until 2.7/3.1
msg71915 - (view) Author: Matt Giuca (mgiuca) Date: 2008-08-25 09:44
It seems like parse_multipart and parse_header are very strongly related
to parse_qs. (eg. if you want to process HTTP requests you'll want to
call parse_qs for x-www-form-urlencoded and parse_multipart for
multipart/form-data).

Should these be moved too? (They aren't part of the url syntax though,
so it doesn't make sense for them to be in urlparse).
msg72284 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-09-01 18:52
Senthil, please update the patchs, adding a DeprecationWarning in 3.0 and
a PendingDeprecationWarning in 2.6.

Thanks!
msg72387 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2008-09-03 15:21
Facundo, I have updated the patch against the trunk. Added the
PendingDeprecationWarning for py26 and DeprecationWarning for py3k. 
All tests pass ok.  Please verify and plan to apply this patch before rc1.
msg72430 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-09-03 22:52
Commited in r66196 and r66199, this went into 2.6/3.0 rc1!!

Thank you all for the effort!
History
Date User Action Args
2022-04-10 16:05:37adminsetgithub: 37091
2008-09-03 22:52:24facundobatistasetstatus: open -> closed
resolution: fixed
messages: + msg72430
2008-09-03 15:21:52orsenthilsetfiles: - issue600362-py3k-v2.diff
2008-09-03 15:21:44orsenthilsetfiles: - issue600362-py26-v2.diff
2008-09-03 15:21:33orsenthilsetfiles: + issue600362-py3k-v3.diff
2008-09-03 15:21:04orsenthilsetfiles: + issue600362-py26-v3.diff
messages: + msg72387
2008-09-01 18:52:27facundobatistasetmessages: + msg72284
2008-08-25 09:44:12mgiucasetnosy: + mgiuca
messages: + msg71915
2008-08-16 14:06:49facundobatistasetmessages: + msg71214
2008-08-14 20:26:56orsenthilsetfiles: - issue600362-py3k.diff
2008-08-14 20:26:49orsenthilsetfiles: - issue600362-py26.diff
2008-08-14 20:26:30orsenthilsetfiles: + issue600362-py3k-v2.diff
2008-08-14 20:26:04orsenthilsetfiles: + issue600362-py26-v2.diff
messages: + msg71151
2008-07-02 15:00:39facundobatistasetassignee: facundobatista
messages: + msg69099
nosy: + facundobatista
2008-06-30 16:58:38benjamin.petersonlinkissue2829 superseder
2008-06-29 11:02:52orsenthilsetmessages: + msg68946
2008-06-29 11:01:39orsenthilsetfiles: + issue600362-py3k.diff
2008-06-29 11:01:12orsenthilsetfiles: + issue600362-py26.diff
2008-06-29 11:00:26orsenthilsetfiles: - issue600362.diff
2008-06-22 04:00:38hdiogenessetmessages: + msg68557
2008-06-21 22:20:37hdiogenessetnosy: + hdiogenes
messages: + msg68551
2008-06-01 20:52:45orsenthilsetfiles: + issue600362.diff
keywords: + patch
messages: + msg67601
2008-01-30 16:12:14draghuramsetnosy: + draghuram, orsenthil
messages: + msg61868
versions: + Python 2.6, Python 3.0
2002-08-26 18:24:42dyoocreate