From 0c3d09fb45a31056740df27a9b02341d558eea95 Mon Sep 17 00:00:00 2001 From: Henri Hulski Date: Tue, 12 Apr 2022 06:40:39 +0200 Subject: [PATCH] fix: pin bleach to version <5 --- mezzanine/accounts/forms.py | 1 - mezzanine/core/admin.py | 1 - mezzanine/core/fields.py | 1 - mezzanine/core/managers.py | 2 +- mezzanine/core/templatetags/mezzanine_tags.py | 1 - mezzanine/utils/html.py | 1 - setup.cfg | 4 ++-- tests/test_core.py | 4 ++-- 8 files changed, 5 insertions(+), 10 deletions(-) diff --git a/mezzanine/accounts/forms.py b/mezzanine/accounts/forms.py index 7551e9037c..93e35b9622 100644 --- a/mezzanine/accounts/forms.py +++ b/mezzanine/accounts/forms.py @@ -31,7 +31,6 @@ class Meta: model = get_profile_model() exclude = (get_profile_user_fieldname(),) + _exclude_fields - except ProfileNotConfigured: pass diff --git a/mezzanine/core/admin.py b/mezzanine/core/admin.py index aa7cdfc521..26eb7ba4ec 100644 --- a/mezzanine/core/admin.py +++ b/mezzanine/core/admin.py @@ -47,7 +47,6 @@ class Media: "all": (static("mezzanine/css/admin/tabbed_translation_fields.css"),), } - else: class BaseTranslationModelAdmin(admin.ModelAdmin): diff --git a/mezzanine/core/fields.py b/mezzanine/core/fields.py index 72928961d8..e82c752fe9 100644 --- a/mezzanine/core/fields.py +++ b/mezzanine/core/fields.py @@ -112,7 +112,6 @@ def __init__(self, *args, **kwargs): kwargs.pop(fb_arg, None) super().__init__(*args, **kwargs) - else: class FileField(FileBrowseField): diff --git a/mezzanine/core/managers.py b/mezzanine/core/managers.py index d835cf7c8b..bee4b8fa6e 100644 --- a/mezzanine/core/managers.py +++ b/mezzanine/core/managers.py @@ -247,7 +247,7 @@ def annotate_scores(self): if result.publish_date: age = (now() - result.publish_date).total_seconds() if age > 0: - count = count / age ** settings.SEARCH_AGE_SCALE_FACTOR + count = count / age**settings.SEARCH_AGE_SCALE_FACTOR results[i].result_count = count return iter(results) diff --git a/mezzanine/core/templatetags/mezzanine_tags.py b/mezzanine/core/templatetags/mezzanine_tags.py index 93a883d8cb..8a7afb3b32 100644 --- a/mezzanine/core/templatetags/mezzanine_tags.py +++ b/mezzanine/core/templatetags/mezzanine_tags.py @@ -52,7 +52,6 @@ def compress(parser, token): return compress(parser, token) - else: @register.to_end_tag diff --git a/mezzanine/utils/html.py b/mezzanine/utils/html.py index 8734c5405a..049b2ca3f4 100644 --- a/mezzanine/utils/html.py +++ b/mezzanine/utils/html.py @@ -9,7 +9,6 @@ class HTMLParseError(Exception): pass - except ImportError: # Python 2 from HTMLParser import HTMLParser, HTMLParseError from htmlentitydefs import name2codepoint diff --git a/setup.cfg b/setup.cfg index cf77a469bb..68343846ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,7 +43,7 @@ install_requires = django-contrib-comments >= 2.0 django >= 2.2 tzlocal >= 2 - bleach >= 2 + bleach >= 2, <5 beautifulsoup4 >= 4.5.3 requests >= 2.1.0 requests-oauthlib >= 1.3 @@ -59,7 +59,7 @@ testing = pytest-cov >= 2, < 3 codestyle = flake8 >= 3, <4 - black==20.8b1 + black == 22.3.0 isort >= 5, <6 pyupgrade >= 2, <3 diff --git a/tests/test_core.py b/tests/test_core.py index 24e181f0da..3f4f8510fc 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -309,14 +309,14 @@ def test_static_proxy_with_static_url_with_full_host(self): def _get_csrftoken(self, response): csrf = re.findall( - br'', + rb'', response.content, ) self.assertEqual(len(csrf), 1, "No csrfmiddlewaretoken found!") return csrf[0] def _get_formurl(self, response): - action = re.findall(br'
', response.content) + action = re.findall(rb'', response.content) self.assertEqual(len(action), 1, "No form with action found!") if action[0] == b"": action = response.request["PATH_INFO"]