Skip to content
  • Marco De Donno's avatar
    43ed89c4
    Add cache for the image_file_serve function · 43ed89c4
    Marco De Donno authored
    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.
    43ed89c4
    Add cache for the image_file_serve function
    Marco De Donno authored
    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.
Loading