From 347fa02eac033879d65e445f49378e29a98b563d Mon Sep 17 00:00:00 2001 From: Satya Mishra Date: Mon, 3 Jul 2023 23:12:00 +0000 Subject: [PATCH] Compatibility change for Pillow 10.0.0 --- CHANGELOG.rst | 3 +++ avatar/conf.py | 2 +- docs/index.txt | 2 +- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 98eba14..8a77ee1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,8 @@ Changelog ========= +* Unreleased + * Use ``Image.Resampling.LANCZOS`` instead of ``Image.LANCZOS`` that was removed in Pillow 10.0.0 + * 7.1.1 (February 23, 2023) * Switch to setuptools for building diff --git a/avatar/conf.py b/avatar/conf.py index caf3da9..a29cec6 100644 --- a/avatar/conf.py +++ b/avatar/conf.py @@ -5,7 +5,7 @@ from PIL import Image class AvatarConf(AppConf): DEFAULT_SIZE = 80 - RESIZE_METHOD = Image.LANCZOS + RESIZE_METHOD = Image.Resampling.LANCZOS STORAGE_DIR = "avatars" PATH_HANDLER = "avatar.models.avatar_path_handler" GRAVATAR_BASE_URL = "https://www.gravatar.com/avatar/" diff --git a/docs/index.txt b/docs/index.txt index 4309714..3de6484 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -211,7 +211,7 @@ appear on the site. Listed below are those settings: .. py:data:: AVATAR_RESIZE_METHOD The method to use when resizing images, based on the options available in - Pillow. Defaults to ``Image.LANCZOS``. + Pillow. Defaults to ``Image.Resampling.LANCZOS``. .. py:data:: AVATAR_STORAGE_DIR diff --git a/requirements.txt b/requirements.txt index ff2aef2..9752ac4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -Pillow>=8.4.0 +Pillow>=9.3.0 django-appconf>=1.0.5 dnspython>=2.3.0