From e3b032b2b441934740f746a1342b473cae19d2c0 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 7 Aug 2023 07:50:55 +0200 Subject: [PATCH 1/4] Improve interoperability --- .pre-commit-config.yaml | 12 ++++++------ CHANGELOG.rst | 4 ++++ feincms/models.py | 9 ++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 625b2cd6..e27f3c58 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,12 +12,12 @@ repos: - id: file-contents-sorter files: .gitignore - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.10.1 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/adamchainz/django-upgrade - rev: 1.13.0 + rev: 1.14.0 hooks: - id: django-upgrade args: [--target-version, "3.2"] @@ -27,16 +27,16 @@ repos: - id: isort args: [--profile=black, --lines-after-imports=2, --combine-as] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 args: ["--ignore=E203,E501,W503"] - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.35.0 + rev: v8.46.0 hooks: - id: eslint args: [--fix] @@ -48,7 +48,7 @@ repos: - "@babel/eslint-parser" - "@babel/preset-env" - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.1 hooks: - id: prettier args: [--list-different, --no-semi] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e67fbd74..bf001901 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,10 @@ Change log .. _Next version: https://github.com/feincms/feincms/compare/v23.1.0...main +- Made the filter argument of content base's ``get_queryset`` method optional. + This enables easier interoperability of FeinCMS content types with feincms3 + plugins. + `v23.1.0`_ (2023-03-09) ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/feincms/models.py b/feincms/models.py index be587ed5..bb8abeba 100644 --- a/feincms/models.py +++ b/feincms/models.py @@ -210,7 +210,7 @@ def _populate_content_type_caches(self, types): if cls not in self._cache["cts"]: if counts: self._cache["cts"][cls] = list( - cls.get_queryset( + cls.get_queryset().filter( reduce( operator.or_, (Q(region=r[0], parent=r[1]) for r in counts), @@ -500,8 +500,11 @@ def render(self, **kwargs): raise NotImplementedError - def get_queryset(cls, filter_args): - return cls.objects.select_related().filter(filter_args) + def get_queryset(cls, filter_args=None): + qs = cls.objects.select_related() + if filter_args is not None: + return qs.filter(filter_args) + return qs attrs = { # The basic content type is put into From 2b9ffbecc908e2003371bb29e6ecce88e5ea1bbd Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 7 Aug 2023 07:55:56 +0200 Subject: [PATCH 2/4] Add Python 3.11 --- .github/workflows/tests.yml | 1 + CHANGELOG.rst | 1 + tox.ini | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4c30d22..cd0c5da4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,6 +17,7 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11" steps: - uses: actions/checkout@v3 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bf001901..4868abc8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ Change log - Made the filter argument of content base's ``get_queryset`` method optional. This enables easier interoperability of FeinCMS content types with feincms3 plugins. +- Added Python 3.11. `v23.1.0`_ (2023-03-09) diff --git a/tox.ini b/tox.ini index be29261a..3fd4055b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py{38,39,310}-dj{32,41,42} - py{310}-dj{32,41,42,main} + py{310,311}-dj{32,41,42,main} [testenv] usedevelop = true @@ -12,5 +12,5 @@ commands = deps = dj32: Django>=3.2,<4.0 dj41: Django>=4.1,<4.2 - dj42: Django>=4.2a1,<5.0 + dj42: Django>=4.2,<5.0 djmain: https://github.com/django/django/archive/main.tar.gz From c64fcdb3028351ea3e61a67406fff466e256c3ce Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 7 Aug 2023 08:24:20 +0200 Subject: [PATCH 3/4] It's Image.Resampling.* now --- CHANGELOG.rst | 1 + feincms/templatetags/feincms_thumbnail.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4868abc8..efbf1190 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ Change log This enables easier interoperability of FeinCMS content types with feincms3 plugins. - Added Python 3.11. +- Fixed the Pillow resampling constant. `v23.1.0`_ (2023-03-09) diff --git a/feincms/templatetags/feincms_thumbnail.py b/feincms/templatetags/feincms_thumbnail.py index 2c774406..9f1b9d5d 100644 --- a/feincms/templatetags/feincms_thumbnail.py +++ b/feincms/templatetags/feincms_thumbnail.py @@ -122,7 +122,7 @@ def generate(self, storage, original, size, miniature): w, h = int(size["w"]), int(size["h"]) format = image.format # Save format for the save() call later - image.thumbnail([w, h], Image.ANTIALIAS) + image.thumbnail([w, h], Image.Resampling.LANCZOS) buf = BytesIO() if format.lower() not in ("jpg", "jpeg", "png"): format = "jpeg" @@ -182,7 +182,7 @@ def generate(self, storage, original, size, miniature): y_offset + int(crop_height), ) ) - image = image.resize((dst_width, dst_height), Image.ANTIALIAS) + image = image.resize((dst_width, dst_height), Image.Resampling.LANCZOS) buf = BytesIO() if format.lower() not in ("jpg", "jpeg", "png"): From ec455aa9067b9f211f271a12e27dc4631d056a5e Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 7 Aug 2023 08:30:00 +0200 Subject: [PATCH 4/4] FeinCMS v23.8.0 --- CHANGELOG.rst | 8 +++++++- feincms/__init__.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index efbf1190..74a5dc1b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,13 @@ Change log `Next version`_ ~~~~~~~~~~~~~~~ -.. _Next version: https://github.com/feincms/feincms/compare/v23.1.0...main +.. _Next version: https://github.com/feincms/feincms/compare/v23.8.0...main + + +`v23.8.0`_ (2023-08-07) +~~~~~~~~~~~~~~~~~~~~~~~ + +.. _v23.8.0: https://github.com/feincms/feincms/compare/v23.1.0...v23.8.0 - Made the filter argument of content base's ``get_queryset`` method optional. This enables easier interoperability of FeinCMS content types with feincms3 diff --git a/feincms/__init__.py b/feincms/__init__.py index dbff7b49..b3462a34 100644 --- a/feincms/__init__.py +++ b/feincms/__init__.py @@ -1,4 +1,4 @@ -VERSION = (23, 1, 0) +VERSION = (23, 8, 0) __version__ = ".".join(map(str, VERSION))