Skip to content
Verified Commit 43ed89c4 authored by Marco De Donno's avatar Marco De Donno
Browse files

Add cache for the image_file_serve function

This is done by splitting the original function in an inner function
that manage the creation of the image in a PIL format. This inner
function is decorated with the redis cache function.

Because of a bug in the PIL library, we can not unPickle a tiff image.
The workaround is to use the following code:

    if isinstance( img, TiffImageFile ):
        if not hasattr( img, "use_load_libtiff" ):
            img.use_load_libtiff = True

Source: https://github.com/python-pillow/Pillow/pull/4565/files

This being patched in the current versions of PIL, we should be use this
monkey-patch for new version of Python.
parent d66f8f2b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment