a
    Døgm  ã                   @   sR   d dl Z d dlZd dlmZmZ d dlmZmZ d dlm	Z	 dd„ Z
d	dd„ZdS )
é    N)Ú	mktime_tzÚparsedate_tz)ÚFileResponseÚHttpResponseNotModified)Ú	http_datec                 K   sL   t  |¡}t| j d¡|tj ƒs(tƒ S tt|dƒƒ}t	|tj ƒ|d< |S )Nzif-modified-sinceÚrbzLast-Modified)
ÚosÚstatÚwas_modified_sinceÚheadersÚgetÚST_MTIMEr   r   Úopenr   )ÚrequestÚfilenameÚkwargsZstatobjÚresponse© r   úg/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/wagtail/utils/sendfile_streaming_backend.pyÚsendfile   s    

þr   c              	   C   sV   z8| du rt ‚t| ƒ}|du r"t ‚t|ƒ}||kr6t ‚W n t tfyP   Y dS 0 dS )a  
    Was something modified since the user last downloaded it?

    header
      This is the value of the If-Modified-Since header.  If this is None,
      I'll just return True.

    mtime
      This is the modification time of the item we're talking about.
    NTF)Ú
ValueErrorr   r   ÚOverflowError)ÚheaderÚmtimeZheader_dateZheader_mtimer   r   r   r
      s    r
   )Nr   )r   r	   Úemail.utilsr   r   Zdjango.httpr   r   Zdjango.utils.httpr   r   r
   r   r   r   r   Ú<module>   s   