Opened 8 years ago

Closed 6 years ago

Last modified 5 years ago

#9089 closed New feature (fixed)

urlencode should support MutliValueDict

Reported by: Thomas Güttler Owned by: gptvnt
Component: Core (Other) Version: 1.0
Severity: Normal Keywords:
Cc: Oliver Beattie 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 Ivan Giuliani 8 years ago.
urlencode-multivaluedict.diff (2.0 KB) - added by Thomas Güttler 8 years ago.
The new patch includes the unittest written by kratorius.
urlencode-multivaluedict.2.diff (2.5 KB) - added by Oliver Beattie 6 years ago.
Updated patch with better tests

Download all attachments as: .zip

Change History (15)

comment:1 Changed 8 years ago by Ivan Giuliani

Component: UncategorizedCore framework

comment:2 Changed 8 years ago by Malcolm Tredinnick

Needs tests: set
Triage Stage: UnreviewedAccepted

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

Changed 8 years ago by Ivan Giuliani

Attachment: multidict-tests-r9066.diff added

comment:3 Changed 8 years ago by Ivan Giuliani

Needs tests: unset

Changed 8 years ago by Thomas Güttler

The new patch includes the unittest written by kratorius.

comment:5 Changed 7 years ago by Oliver Beattie

Cc: Oliver Beattie added

comment:6 Changed 7 years ago by Oliver Beattie

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 6 years ago by gptvnt

Owner: changed from nobody to gptvnt
Status: newassigned

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 6 years ago by Julien Phalip

Patch needs improvement: set
Severity: Normal
Type: New feature

Patch needs improvement as per gptvnt's comment.

Changed 6 years ago by Oliver Beattie

Updated patch with better tests

comment:9 Changed 6 years ago by Oliver Beattie

Patch needs improvement: unset

comment:10 Changed 6 years ago by Julien Phalip

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

comment:11 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

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 5 years ago by Thomas Güttler

Cc: hv@… removed
UI/UX: unset
Note: See TracTickets for help on using tickets.
Back to Top