django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.73k stars 574 forks source link

PIL.Image.MAX_IMAGE_PIXELS = None will trigger an exception in django-filer #1474

Open benzkji opened 1 month ago

benzkji commented 1 month ago

In my settings.py I have this:

from PIL import Image
Image.MAX_IMAGE_PIXELS = None

So my app fails to start:

  File "/home/xxx/.virtualenvs/xxx/lib/python3.9/site-packages/filer/models/abstract.py", line 27, in <module>
    FILER_MAX_IMAGE_PIXELS = min(
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

This should not be, as None is a valid value for PIL's Image.MAX_IMAGE_PIXELS?

Happens with filer >= 3.1.0.

fsbraun commented 1 month ago

Agree, None should be valid.

fsbraun commented 1 month ago

Just for completeness: I strongly recommend to set settings.FILER_MAX_IMAGE_PIXELS if Image.MAX_IMAGE_PIXELS is None.

benzkji commented 1 month ago

I know :) This bug helped me clean up my project...

benzkji commented 1 month ago

Thanks anyway, for the fix!