Fix build failure caused by python-django update to 4.2.15
(cherry picked from commit 030261c3708b7b65126c21f1719d2b36f39cecf4)
This commit is contained in:
parent
c9f4475fb8
commit
894342738c
131
Fixes-for-django-4.0.patch
Normal file
131
Fixes-for-django-4.0.patch
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
From 8abebb36b1ec64b1e1228634e42381c0f592fdd4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luke Pomfrey <luke@lukepomfrey.org>
|
||||||
|
Date: Tue, 4 Jan 2022 13:57:51 +0000
|
||||||
|
Subject: [PATCH] Fixes for django 4.0
|
||||||
|
|
||||||
|
Origin:
|
||||||
|
https://github.com/lpomfrey/django-debreach/commit/8abebb36b1ec64b1e1228634e42381c0f592fdd4
|
||||||
|
---
|
||||||
|
debreach/tests.py | 12 ++++++------
|
||||||
|
setup.py | 2 ++
|
||||||
|
test_project/urls.py | 18 +++++++-----------
|
||||||
|
3 files changed, 15 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/debreach/tests.py b/debreach/tests.py
|
||||||
|
index 70eedb0..4626e7d 100644
|
||||||
|
--- a/debreach/tests.py
|
||||||
|
+++ b/debreach/tests.py
|
||||||
|
@@ -21,7 +21,7 @@ class TestRandomCommentMiddleware(TestCase):
|
||||||
|
def test_noop_on_wrong_content_type(self):
|
||||||
|
response = HttpResponse('abc', content_type='text/plain')
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
response = middleware.process_response(request, response)
|
||||||
|
self.assertEqual(response.content, b'abc')
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ class TestRandomCommentMiddleware(TestCase):
|
||||||
|
</html>'''
|
||||||
|
response = HttpResponse(html, content_type='text/html')
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
response = middleware.process_response(request, response)
|
||||||
|
self.assertNotEqual(response.content, html)
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ class TestRandomCommentMiddleware(TestCase):
|
||||||
|
</html>'''.format(''.join(chr(x) for x in range(9999)))
|
||||||
|
response = HttpResponse(html, content_type='text/html')
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
response = middleware.process_response(request, response)
|
||||||
|
self.assertNotEqual(force_str(response.content), force_str(html))
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ class TestRandomCommentMiddleware(TestCase):
|
||||||
|
response = HttpResponse(html)
|
||||||
|
response._random_comment_exempt = True
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
response = middleware.process_response(request, response)
|
||||||
|
self.assertEqual(force_str(response.content), html)
|
||||||
|
|
||||||
|
@@ -75,14 +75,14 @@ class TestRandomCommentMiddleware(TestCase):
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
response = HttpResponse('')
|
||||||
|
del response['Content-Type']
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
processed_response = middleware.process_response(request, response)
|
||||||
|
self.assertEqual(response, processed_response)
|
||||||
|
|
||||||
|
def test_empty_response_body_ignored(self):
|
||||||
|
request = RequestFactory().get('/')
|
||||||
|
response = HttpResponse('')
|
||||||
|
- middleware = RandomCommentMiddleware()
|
||||||
|
+ middleware = RandomCommentMiddleware(lambda request: response)
|
||||||
|
processed_response = middleware.process_response(request, response)
|
||||||
|
self.assertEqual(len(processed_response.content), 0)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 850b52b..7c54d1b 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -68,6 +68,8 @@ setup(
|
||||||
|
'Operating System :: OS Independent',
|
||||||
|
'Framework :: Django',
|
||||||
|
'Framework :: Django :: 2.2',
|
||||||
|
+ 'Framework :: Django :: 3.2',
|
||||||
|
+ 'Framework :: Django :: 4.0',
|
||||||
|
'Programming Language :: Python',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
|
diff --git a/test_project/urls.py b/test_project/urls.py
|
||||||
|
index d74ec85..cf2a802 100644
|
||||||
|
--- a/test_project/urls.py
|
||||||
|
+++ b/test_project/urls.py
|
||||||
|
@@ -1,13 +1,12 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
-from django.conf.urls import url
|
||||||
|
+from django.urls import re_path
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
|
from django.views.generic.edit import FormView
|
||||||
|
|
||||||
|
from test_project.forms import TestForm
|
||||||
|
|
||||||
|
-
|
||||||
|
# Uncomment the next two lines to enable the admin:
|
||||||
|
# from django.contrib import admin
|
||||||
|
# admin.autodiscover()
|
||||||
|
@@ -16,19 +15,16 @@ urlpatterns = [
|
||||||
|
# Examples:
|
||||||
|
# url(r'^$', 'test_project.views.home', name='home'),
|
||||||
|
# url(r'^test_project/', include('test_project.foo.urls')),
|
||||||
|
-
|
||||||
|
# Uncomment the admin/doc line below to enable admin documentation:
|
||||||
|
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||||
|
-
|
||||||
|
# Uncomment the next line to enable the admin:
|
||||||
|
# url(r'^admin/', include(admin.site.urls)),
|
||||||
|
- url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
|
||||||
|
- url(
|
||||||
|
- r'^form/$',
|
||||||
|
+ re_path(r"^$", TemplateView.as_view(template_name="home.html"), name="home"),
|
||||||
|
+ re_path(
|
||||||
|
+ r"^form/$",
|
||||||
|
FormView.as_view(
|
||||||
|
- form_class=TestForm,
|
||||||
|
- template_name='test.html',
|
||||||
|
- success_url='/'),
|
||||||
|
- name='test_form'
|
||||||
|
+ form_class=TestForm, template_name="test.html", success_url="/"
|
||||||
|
+ ),
|
||||||
|
+ name="test_form",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
Name: python-%{pypi_name}
|
Name: python-%{pypi_name}
|
||||||
Version: 2.0.1
|
Version: 2.0.1
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Basic/extra mitigation against the BREACH attack for Django projects
|
Summary: Basic/extra mitigation against the BREACH attack for Django projects
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://github.com/lpomfrey/django-debreach
|
URL: http://github.com/lpomfrey/django-debreach
|
||||||
Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
|
||||||
|
Patch0: Fixes-for-django-4.0.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
@ -34,7 +35,7 @@ like django-ratelimit, the techniques here should provide at least some
|
|||||||
protection against the BREACH attack.
|
protection against the BREACH attack.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{pypi_name}-%{version}
|
%autosetup -n %{pypi_name}-%{version} -p1
|
||||||
# Remove bundled egg-info
|
# Remove bundled egg-info
|
||||||
rm -rf %{pypi_name}.egg-info
|
rm -rf %{pypi_name}.egg-info
|
||||||
|
|
||||||
@ -52,5 +53,8 @@ PYTHONPATH=. %{__python3} setup.py test
|
|||||||
%{python3_sitelib}/django_debreach-%{version}-py%{python3_version}.egg-info
|
%{python3_sitelib}/django_debreach-%{version}-py%{python3_version}.egg-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 08 2024 yaoxin <yao_xin001@hoperun.com> - 2.0.1-2
|
||||||
|
- Fix build failure caused by python-django update to 4.2.15
|
||||||
|
|
||||||
* Wed Jan 29 2021 liusheng <liusheng2048@gmail.com> - 2.0.1-1
|
* Wed Jan 29 2021 liusheng <liusheng2048@gmail.com> - 2.0.1-1
|
||||||
- Init package for python-django-debreach
|
- Init package for python-django-debreach
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user