diff --git a/src/authentic2/forms/fields.py b/src/authentic2/forms/fields.py index 14bf8f332..762e0a182 100644 --- a/src/authentic2/forms/fields.py +++ b/src/authentic2/forms/fields.py @@ -147,7 +147,12 @@ class ProfileImageField(FileField): box[3] += box[1] image = image.crop(box) - return image.resize([width, height], PIL.Image.LANCZOS) + try: + resampling_algorithm = PIL.Image.Resampling.LANCZOS + except AttributeError: + # can be removed when Pillow < 9.1.0 is not supported anymore + resampling_algorithm = PIL.Image.LANCZOS + return image.resize([width, height], resampling_algorithm) class ValidatedEmailField(EmailField): diff --git a/tox.ini b/tox.ini index ebd3d25e9..4af84c24a 100644 --- a/tox.ini +++ b/tox.ini @@ -179,6 +179,7 @@ filterwarnings = error:.*please use dns.resolver.resolve:DeprecationWarning: error:.*Passing None for the middleware get_response argument is deprecated.*:: error:.*ANTIALIAS is deprecated and will be removed in Pillow 10:: + error:.*LANCZOS.*Pillow 10:: junit_family=xunit2 [coverage:run]