U
    {h                     @   s    d dl mZ dd Zdd ZdS )    )SourceImageIOErrorc                 C   sH   z|  |W S  tk
rB   | jj}|| ddd}d|j_| Y S X dS )z
    Tries to get / create the rendition for the image or renders a not-found image if it does not exist.

    :param image: AbstractImage
    :param specs: str or Filter
    :return: Rendition
    r   imagewidthheight	not-foundN)Zget_renditionr   
renditionsmodelfilename)r   specs	Rendition	rendition r   `/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/images/shortcuts.pyget_rendition_or_not_found   s    r   c                    sV   z| j | W S  tk
rP   | jj}|| ddd d j_ fdd|D  Y S X dS )a  
    Like get_rendition_or_not_found, but for multiple renditions.
    Tries to get / create the renditions for the image or renders not-found images if the image does not exist.

    :param image: AbstractImage
    :param specs: iterable of str or Filter
    r   r   r   c                    s"   i | ]}t |tr|n|j qS r   )
isinstancestrspec).0r   r   r   r   
<dictcomp>(   s     z/get_renditions_or_not_found.<locals>.<dictcomp>N)Zget_renditionsr   r   r	   r
   r   )r   r   r   r   r   r   get_renditions_or_not_found   s    
r   N)Zwagtail.images.modelsr   r   r   r   r   r   r   <module>   s   