a
    Dg                     @   s    d dl mZ dd Zdd ZdS )    )SourceImageIOErrorc                 C   sF   z|  |W S  ty@   | jj}|| ddd}d|j_| Y S 0 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   W/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/wagtail/images/shortcuts.pyget_rendition_or_not_found   s    r   c                    sT   z| j | W S  tyN   | jj}|| ddd d j_ fdd|D  Y S 0 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   