Opened 16 years ago

Closed 13 years ago

Last modified 12 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 16 years ago.
urlencode-multivaluedict.diff (2.0 KB ) - added by Thomas Güttler 15 years ago.
The new patch includes the unittest written by kratorius.
urlencode-multivaluedict.2.diff (2.5 KB ) - added by Oliver Beattie 13 years ago.
Updated patch with better tests

Download all attachments as: .zip

Change History (15)

comment:1 by Ivan Giuliani, 16 years ago

Component: UncategorizedCore framework

comment:2 by Malcolm Tredinnick, 16 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

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

by Ivan Giuliani, 16 years ago

Attachment: multidict-tests-r9066.diff added

comment:3 by Ivan Giuliani, 16 years ago

Needs tests: unset

by Thomas Güttler, 15 years ago

The new patch includes the unittest written by kratorius.

comment:5 by Oliver Beattie, 14 years ago

Cc: Oliver Beattie added

comment:6 by Oliver Beattie, 14 years ago

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

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

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

Patch needs improvement as per gptvnt's comment.

by Oliver Beattie, 13 years ago

Updated patch with better tests

comment:9 by Oliver Beattie, 13 years ago

Patch needs improvement: unset

comment:10 by Julien Phalip, 13 years ago

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

comment:11 by Jannis Leidel, 13 years ago

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

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