#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)
Change History (15)
comment:1 by , 17 years ago
| Component: | Uncategorized → Core framework | 
|---|
comment:2 by , 17 years ago
| Needs tests: | set | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
by , 17 years ago
| Attachment: | multidict-tests-r9066.diff added | 
|---|
comment:3 by , 17 years ago
| Needs tests: | unset | 
|---|
by , 17 years ago
| Attachment: | urlencode-multivaluedict.diff added | 
|---|
The new patch includes the unittest written by kratorius.
comment:5 by , 16 years ago
| Cc: | added | 
|---|
comment:6 by , 15 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 , 15 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → 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 by , 15 years ago
| Patch needs improvement: | set | 
|---|---|
| Severity: | → Normal | 
| Type: | → New feature | 
Patch needs improvement as per gptvnt's comment.
by , 15 years ago
| Attachment: | urlencode-multivaluedict.2.diff added | 
|---|
Updated patch with better tests
comment:9 by , 15 years ago
| Patch needs improvement: | unset | 
|---|
comment:10 by , 15 years ago
| Easy pickings: | unset | 
|---|---|
| Triage Stage: | Accepted → Ready for checkin | 
comment:12 by , 14 years ago
| Cc: | removed | 
|---|---|
| UI/UX: | unset | 
Repeat after me: "whenever I submit a patch to add a new feature, it must include tests." Thankyou. :-)