Accepting request 629188 from devel:languages:python:django
- Apply patch to fix urlencode nonstring values: * django-urlencode.patch OBS-URL: https://build.opensuse.org/request/show/629188 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Django?expand=0&rev=42
This commit is contained in:
commit
3c4545d4e2
43
django-urlencode.patch
Normal file
43
django-urlencode.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From d8e2be459f97f1773c7edf7d37de180139146176 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tim Graham <timograham@gmail.com>
|
||||||
|
Date: Thu, 2 Aug 2018 21:56:26 -0400
|
||||||
|
Subject: [PATCH] Fixed #29627 -- Fixed QueryDict.urlencode() crash with
|
||||||
|
non-string values.
|
||||||
|
|
||||||
|
Regression in 7d96f0c49ab750799860e42716d7105e11de44de.
|
||||||
|
---
|
||||||
|
django/http/request.py | 2 +-
|
||||||
|
tests/httpwrappers/tests.py | 7 +++++++
|
||||||
|
3 files changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/django/http/request.py b/django/http/request.py
|
||||||
|
index 05aa89252bbc..fdd1cf8c6732 100644
|
||||||
|
--- a/django/http/request.py
|
||||||
|
+++ b/django/http/request.py
|
||||||
|
@@ -511,7 +511,7 @@ def encode(k, v):
|
||||||
|
return urlencode({k: v})
|
||||||
|
for k, list_ in self.lists():
|
||||||
|
output.extend(
|
||||||
|
- encode(k.encode(self.encoding), v.encode(self.encoding))
|
||||||
|
+ encode(k.encode(self.encoding), str(v).encode(self.encoding))
|
||||||
|
for v in list_
|
||||||
|
)
|
||||||
|
return '&'.join(output)
|
||||||
|
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
|
||||||
|
index 24260ae61055..01ce20f93d85 100644
|
||||||
|
--- a/tests/httpwrappers/tests.py
|
||||||
|
+++ b/tests/httpwrappers/tests.py
|
||||||
|
@@ -114,6 +114,13 @@ def test_urlencode(self):
|
||||||
|
self.assertEqual(q.urlencode(), 'next=%2Ft%C3%ABst%26key%2F')
|
||||||
|
self.assertEqual(q.urlencode(safe='/'), 'next=/t%C3%ABst%26key/')
|
||||||
|
|
||||||
|
+ def test_urlencode_int(self):
|
||||||
|
+ # Normally QueryDict doesn't contain non-string values but lazily
|
||||||
|
+ # written tests may make that mistake.
|
||||||
|
+ q = QueryDict(mutable=True)
|
||||||
|
+ q['a'] = 1
|
||||||
|
+ self.assertEqual(q.urlencode(), 'a=1')
|
||||||
|
+
|
||||||
|
def test_mutable_copy(self):
|
||||||
|
"""A copy of a QueryDict is mutable."""
|
||||||
|
q = QueryDict().copy()
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Aug 14 07:46:04 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Apply patch to fix urlencode nonstring values:
|
||||||
|
* django-urlencode.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Aug 8 13:33:57 UTC 2018 - tchvatal@suse.com
|
Wed Aug 8 13:33:57 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ Source: https://www.djangoproject.com/m/releases/2.1/Django-%{version}.t
|
|||||||
Source1: https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.txt#/Django-%{version}.tar.gz.asc
|
Source1: https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.txt#/Django-%{version}.tar.gz.asc
|
||||||
Source2: %{name}.keyring
|
Source2: %{name}.keyring
|
||||||
Source99: python-Django-rpmlintrc
|
Source99: python-Django-rpmlintrc
|
||||||
|
Patch0: django-urlencode.patch
|
||||||
BuildRequires: %{python_module Jinja2 >= 2.9.2}
|
BuildRequires: %{python_module Jinja2 >= 2.9.2}
|
||||||
BuildRequires: %{python_module Pillow}
|
BuildRequires: %{python_module Pillow}
|
||||||
BuildRequires: %{python_module PyYAML}
|
BuildRequires: %{python_module PyYAML}
|
||||||
@ -78,6 +79,7 @@ echo "`grep -e '^[0-9a-f]\{40\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-
|
|||||||
echo "`grep -e '^[0-9a-f]\{64\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-64` %{SOURCE0}" | sha256sum -c
|
echo "`grep -e '^[0-9a-f]\{64\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-64` %{SOURCE0}" | sha256sum -c
|
||||||
|
|
||||||
%setup -q -n Django-%{version}
|
%setup -q -n Django-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user