Skip to content

relocate cgi.parse_qs() into urlparse #37091

Closed

Description

@dyoo
mannequin
BPO 600362
Nosy @brettcannon, @facundobatista, @orsenthil, @hdiogenes
Files
  • issue600362-py26-v3.diff
  • issue600362-py3k-v3.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/facundobatista'
    closed_at = <Date 2008-09-03.22:52:24.529>
    created_at = <Date 2002-08-26.18:24:42.000>
    labels = ['type-feature']
    title = 'relocate cgi.parse_qs() into urlparse'
    updated_at = <Date 2008-09-03.22:52:24.528>
    user = 'https://bugs.python.org/dyoo'

    bugs.python.org fields:

    activity = <Date 2008-09-03.22:52:24.528>
    actor = 'facundobatista'
    assignee = 'facundobatista'
    closed = True
    closed_date = <Date 2008-09-03.22:52:24.529>
    closer = 'facundobatista'
    components = ['None']
    creation = <Date 2002-08-26.18:24:42.000>
    creator = 'dyoo'
    dependencies = []
    files = ['11356', '11357']
    hgrepos = []
    issue_num = 600362
    keywords = ['patch']
    message_count = 14.0
    messages = ['61094', '61095', '61868', '67601', '68551', '68557', '68946', '69099', '71151', '71214', '71915', '72284', '72387', '72430']
    nosy_count = 7.0
    nosy_names = ['brett.cannon', 'facundobatista', 'dyoo', 'orsenthil', 'draghuram', 'hdiogenes', 'mgiuca']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue600362'
    versions = ['Python 2.6', 'Python 3.0']

    Activity

    1. dyoo commented on Aug 26, 2002

      dyoomannequin
      MannequinAuthor

      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!

    2. brettcannon commented on May 13, 2003

      @brettcannon
      Member

      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?

    3. draghuram commented on Jan 30, 2008

      draghurammannequin
      Mannequin

      I know that Senthil has been working on consolidating url related
      functionalities so I am adding him to the list.

    4. orsenthil commented on Jun 1, 2008

      @orsenthil
      Member

      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.

    5. hdiogenes commented on Jun 21, 2008

      hdiogenesmannequin
      Mannequin

      The patch is not applying cleanly.

      BTW, urlparse has been renamed to urllib.parse, but the old docs are still
      there (urlparse.rst).

    6. hdiogenes commented on Jun 22, 2008

      hdiogenesmannequin
      Mannequin

      Correction: the patch does apply cleanly to 2.6, without breaking tests.
      It just needs to be ported to 3.0 (new urllib package).

    7. orsenthil commented on Jun 29, 2008

      @orsenthil
      Member
      • 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.

    8. facundobatista commented on Jul 2, 2008

      @facundobatista
      Member

      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!!

    9. orsenthil commented on Aug 14, 2008

      @orsenthil
      Member

      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

    10. facundobatista commented on Aug 16, 2008

      @facundobatista
      Member

      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

    11. mgiuca commented on Aug 25, 2008

      mgiucamannequin
      Mannequin

      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).

    12. facundobatista commented on Sep 1, 2008

      @facundobatista
      Member

      Senthil, please update the patchs, adding a DeprecationWarning in 3.0 and
      a PendingDeprecationWarning in 2.6.

      Thanks!

    13. orsenthil commented on Sep 3, 2008

      @orsenthil
      Member

      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.

    14. facundobatista commented on Sep 3, 2008

      @facundobatista
      Member

      Commited in r66196 and r66199, this went into 2.6/3.0 rc1!!

      Thank you all for the effort!

    15. transferred this issue fromon Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions