Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#29627 closed Bug (fixed)

QueryDict.urlencode() crashes on non-string values

Reported by: Rafał P. Owned by: nobody
Component: HTTP handling Version: 2.1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In version 2.0 it was possible to pass integer values to QueryDict and urlencode() it:

from django.http import QueryDict
d = QueryDict('', mutable=True)
d["a"] = 1
d.urlencode()
'a=1'

in 2.1 it raises AttributeError: 'int' object has no attribute 'encode'. I think this should be listed as backward - incompatible change in the Release Notes.

Change History (4)

comment:1 Changed 19 months ago by Tim Graham

Component: UncategorizedHTTP handling
Severity: NormalRelease blocker
Summary: QueryDict.urlencode() behaviour changedQueryDict.urlencode() crashes on non-string values
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Bisected to 7d96f0c49ab750799860e42716d7105e11de44de. We might restore the old behavior.

comment:2 Changed 19 months ago by Tim Graham

Has patch: set

comment:3 Changed 19 months ago by GitHub <noreply@…>

Resolution: fixed
Status: newclosed

In d8e2be45:

Fixed #29627 -- Fixed QueryDict.urlencode() crash with non-string values.

Regression in 7d96f0c49ab750799860e42716d7105e11de44de.

comment:4 Changed 19 months ago by Tim Graham <timograham@…>

In 0cfca0f2:

[2.1.x] Fixed #29627 -- Fixed QueryDict.urlencode() crash with non-string values.

Regression in 7d96f0c49ab750799860e42716d7105e11de44de.
Backport of d8e2be459f97f1773c7edf7d37de180139146176 from master

Note: See TracTickets for help on using tickets.
Back to Top