Opened 6 years ago

Closed 6 years ago

Last modified 6 years 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 by Tim Graham, 6 years ago

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 by Tim Graham, 6 years ago

Has patch: set

comment:3 by GitHub <noreply@…>, 6 years ago

Resolution: fixed
Status: newclosed

In d8e2be45:

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

Regression in 7d96f0c49ab750799860e42716d7105e11de44de.

comment:4 by Tim Graham <timograham@…>, 6 years ago

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