Opened 15 years ago
Closed 13 years ago
#12140 closed Bug (fixed)
urlencode empty list encoding bug & fix
Reported by: | aneil | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | urlencode |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
django.utils.http.urlencode
doesn't behave the same as urllib.urlencode for empty lists:
urllib.urlencode({'foo':[]},True) => ''
django.utils.http.urlencode({'foo':[]},True) => 'foo=%5B%5D'
The attached diff has a change at line 557 in trunk/django/utils/http.py:
- isinstance(v, (list,tuple)) and [smart_str(i) for i in v] or smart_str(v)) + [smart_str(i) for i in v] if isinstance(v, (list,tuple)) else smart_str(v))
Attached.
Attachments (2)
Change History (12)
by , 15 years ago
Attachment: | urlencode.diff added |
---|
comment:2 by , 15 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 14 years ago
Needs tests: | unset |
---|---|
Version: | 1.1 → SVN |
I've updated the patch to include tests for this. It's all isolated in a branch here: http://github.com/ericflo/django/compare/ticket12140
comment:4 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:5 by , 14 years ago
Patch needs improvement: | set |
---|
The tests would need to be rewritten using unittests since this is now Django's preferred way.
comment:9 by , 13 years ago
Patch needs improvement: | unset |
---|
comment:10 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
urlencode empty list bug patch