Code

Opened 6 years ago

Closed 3 years ago

Last modified 2 years ago

#9089 closed New feature (fixed)

urlencode should support MutliValueDict

Reported by: guettli Owned by: gptvnt
Component: Core (Other) Version: 1.0
Severity: Normal Keywords:
Cc: obeattie Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This small patch of django.utils.http lets urlencode() handle list values in MultiValueDict instances
correctly.

Before:

>>> from django.utils.http import urlencode
>>> from django.utils.datastructures import MultiValueDict
>>> urlencode(MultiValueDict({'test': [1, 2, 3]}), doseq=True)
'test=3'

With patch:

>>> urlencode(MultiValueDict({'test': [1, 2, 3]}), doseq=True)
'test=1&test=2&test=3'

Attachments (3)

multidict-tests-r9066.diff (1.2 KB) - added by kratorius 6 years ago.
urlencode-multivaluedict.diff (2.0 KB) - added by guettli 6 years ago.
The new patch includes the unittest written by kratorius.
urlencode-multivaluedict.2.diff (2.5 KB) - added by obeattie 3 years ago.
Updated patch with better tests

Download all attachments as: .zip

Change History (15)

comment:1 Changed 6 years ago by kratorius

  • Component changed from Uncategorized to Core framework
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by mtredinnick

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

Repeat after me: "whenever I submit a patch to add a new feature, it must include tests." Thankyou. :-)

Changed 6 years ago by kratorius

comment:3 Changed 6 years ago by kratorius

  • Needs tests unset

Changed 6 years ago by guettli

The new patch includes the unittest written by kratorius.

comment:5 Changed 4 years ago by obeattie

  • Cc obeattie added

comment:6 Changed 4 years ago by obeattie

Hate to nag, but is there a reason this hasn't been committed? Seems like such an obvious change that is actually useful. I'm using a custom urlencode function for now, but I really don't see any reason this shouldn't be checked-in.

comment:7 Changed 4 years ago by gptvnt

  • Owner changed from nobody to gptvnt
  • Status changed from new to assigned

I verified, the patch is good. Although the tests have been restructured recently and the test patch attached is no longer valid. I take the responsibility of rewriting the test patch as per the latest structure.

comment:8 Changed 3 years ago by julien

  • Patch needs improvement set
  • Severity set to Normal
  • Type set to New feature

Patch needs improvement as per gptvnt's comment.

Changed 3 years ago by obeattie

Updated patch with better tests

comment:9 Changed 3 years ago by obeattie

  • Patch needs improvement unset

comment:10 Changed 3 years ago by julien

  • Easy pickings unset
  • Triage Stage changed from Accepted to Ready for checkin

comment:11 Changed 3 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16064]:

Fixed #9089 -- Correctly handle list values in MultiValueDict instances when passed to django.utils.http.urlencode. Thanks, kratorius, guettli and obeattie.

comment:12 Changed 2 years ago by guettli

  • Cc hv@… removed
  • UI/UX unset

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.