From 0f7b5b38b603e06d6e3c8bdeecd096ad7f305af6 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 15 Nov 2017 18:14:53 -0500 Subject: [PATCH] [2.0.x] Fixed #28796 -- Doc'd backwards incompatibility when reverse() receives bytestring args/kwargs. Due to 301de774c21d055e9e5a7073e5bffdb52bc71079. Backport of 6bf85ff7e3b837378589e449ba27be8971d9b14c from master --- docs/releases/2.0.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index 18d170aa1b5..904597a0332 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -349,6 +349,12 @@ of binary fields or HTTP streams, for example). You might have to update your code to limit bytestring usage to a minimum, as Django no longer accepts bytestrings in certain code paths. +For example, ``reverse()`` now uses ``str()`` instead of ``force_text()`` to +coerce the ``args`` and ``kwargs`` it receives, prior to their placement in +the URL. For bytestrings, this creates a string with an undesired ``b`` prefix +as well as additional quotes (``str(b'foo')`` is ``"b'foo'"``). To adapt, call +``decode()`` on the bytestring before passing it to ``reverse()``. + Database backend API --------------------